AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

Ads
4.9K members online now
4.9K members online now
Dive into advanced features like Remarketing, Flexible Bid Strategies, AdWords Editor, and AdWords Scripts
Guide Me
star_border
Reply

Opposite to Countdown

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hello All.

 

I was wondering if there is a "function" (read: customizer) which is the opposite of COUNTDOWN.  I want to tell my customers how many days past deadline they now are.

 

Is there any way to do this?

2 Expert replyverified_user

Re: Opposite to Countdown

Rising Star
# 2
Rising Star
Well at the moment no you can't show it through a Ad customizer count down option. But I'm curious about how you going to use this kind of thing in a ad text?

Mind sharing your idea? So may be we can come with an alternative

Re: Opposite to Countdown

Top Contributor
# 3
Top Contributor

Hi @Temi U you could do this fairly easily with a Script using the adParam method.

 

Create an Ad using {param1:default text} where the replaced parmeter is your number of days (replace "default text with something appropriate).  Then use a script that'll calculate the number of days and replace the param with the number.  Something like this should work:  I haven't tested this so can't guarantee there are no errors.  Make a new script, insert your own Campaign name and then PREVIEW the script.  If it works you should see a number of days in the Logs pane.  You may have to tweak it to get it right.

 

// Date to use to find out how many days have passed.
var END_DATE = new Date('June 4, 2015');

 

function main() {
var timeSince = calculateTimeLeftUntil(END_DATE);
var groupIter = AdWordsApp.adGroups()
.withCondition("CampaignName = 'Your_Campaign_Name")  //or other selector
.withCondition("Status = 'ENABLED'")
.get();

 

Logger.log("Days: " + timeSince['days']);


while(groupIter.hasNext()) {
var thisGroup = groupIter.next();
var keywords = thisGroup.keywords().get();
while (keywords.hasNext()) {
var keyword = keywords.next();
keyword.setAdParam(1, timeSince['days']);
}
}
}

 

function calculateTimeSince(end) {
var current = new Date();
var timeSince = {};
var daysFloat = (end - current) /86400000;
timeSince['days'] = Math.floor(daysFloat);

return Math.abs(timeSince);

}

AdWords Top Contributor Google+ Profile | Partner Profile | AdWords Audits