Automated switching on and off campaigns

148 views
Skip to first unread message

WebMarkets

unread,
Sep 27, 2005, 5:55:12 PM9/27/05
to AdWords API Forum
First I am going to have to appologise if this has been answered
somewhere on here else where. I just can't find it, if it has been.

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.

nwhite

unread,
Sep 27, 2005, 7:24:02 PM9/27/05
to AdWords API Forum
I personal have no need for a script of this nature but it would be
very easy to do using the php api called APIlity:
http://google-apility.sourceforge.net/

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.

Richard Jones

unread,
Sep 28, 2005, 5:53:38 AM9/28/05
to WebMarkets, AdWords API Forum

Easy enough with our command line tools:

http://merjis.com/developers/adwords_api

./campaign.opt pause 'regexp'
./campaign.opt resume 'regexp'

where regexp is a regular expression which matches the campaign(s)
which you want to switch off/on.

We use this in the travel sector because amazingly their booking
engines don't run 24/7. They switch them off at night(!)

Rich.

--
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Team Notepad - intranets and extranets for business - http://team-notepad.com

Patrick Chanezon

unread,
Oct 5, 2005, 12:21:53 AM10/5/05
to WebMarkets, AdWords API Forum
I haven't heard about such a script, but you could write it pretty easily yourself either using APIlity (an open source AdWords API PHP client library) or our friends Merjis' open source AdWords API OCAML client library (I remember they mentioned having some command lines utilities shipping with it.
http://google-apility.sourceforge.net/
http://merjis.com/developers/adwords_api

If you don't have the time or ressources to create the script yourself you should look at the recdent thread we had in this Forum about  Outsourcing Development of AdWords API.

I hope this helps.

P@
--
Patrick Chanezon, AdWords API evangelist
http://blog.chanezon.com/
http://www.google.com/apis/adwords/
Reply all
Reply to author
Forward
0 new messages