-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathWeekDayMobileBids.js
45 lines (40 loc) · 1.23 KB
/
WeekDayMobileBids.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
author: FKrauss
Inputs for mobile bids based on weekday
*/
function main() {
var campaignfilter = "DEST"; // add the terms the account must have to get the adjustments
var campaignnegfilter = "App"; // add the term the account must not have to get the adjustments
var selector = AdWordsApp.campaigns()
.withCondition("CampaignName CONTAINS \'"+ campaignfilter+"\'")
.withCondition("CampaignName DOES_NOT_CONTAIN_IGNORE_CASE \'"+ campaignnegfilter+"\'");
switch (new Date().getDay()) {
case 0:
bid = 0.1; //Sunday
break;
case 1:
bid = -0.3; // Monday
break;
case 2:
bid = 0.2; // Tuesday
break;
case 3:
bid = -0.3; //Wednesday
break;
case 4:
bid = -0.3; //Thursday
break;
case 5:
bid = -0.3; // Friday
break;
case 6:
bid = 0.1; //Saturday
break; }
var campaignIterator = selector.get();
while(campaignIterator.hasNext()) {
var campaign = campaignIterator.next();
var MobileBidAdjustment = campaign.targeting().platforms().mobile().get().next();
MobileBidAdjustment.setBidModifier(1+bid);
Logger.log(campaign.getName()+" modified to "+ (1+bid)*100 +"%");
}
}