My question I think will be useful to others I hope to though.
I have a number of clients in the hotel and holiday homes markets. I
have found that certain times of the day are of no use in this market
and only attract tyre kickers who just use up all the daily funds. So
what I do now is switch these campaigns off during those times of the
day I know are not worth running the campaigns during.
So anyway my question is has any one got a simple and easy to implement
method of switching on a campaign and off again using some kind of
shell script or perl/php script and an .init file which holds names and
times of campaigns to run at.
This prog I would want to run as a continually running process on my
machine which is always networked. Then I could be lazy and not have to
do this switching on and off every day which is a real pain.
I imagine this could be done simply using a cron job and a script which
calls the adwords API. Has anyone written such a thing and would they
be kind enough to share it. Be so greatful as I bit simple and far too
slow at codeing and so hate doing it.
here is some code to get you started:
// get all campaigns
$campaigns = getAllCampaigns();
foreach($campaigns as $campaign){
// get the status of the current campaign
$currentStatus = $campaign->getStatus();
if($currentStatus == "Active"){
// if the campaign is currently active, pause it
$campaign->setStatus("Paused");
}
elseif($currentStatus == "Paused"){
// if the campaign is currently paused, make it active
$campaign->setStatus("Active");
}
}
That should be it! All you need to do is put the script into a cron job
to match the times when you want your ads to turn on and off.
Note: If you have a more complex account setup this may not work,
please review the documentation and review your own ads before trying
this. This is only an example, and as such the code has not been tested.