Dynamic exitUrl generated from setTargeting-key-value - is it possible? (GWD & DFP)

153 views
Skip to first unread message

samu.t...@gmail.com

unread,
Nov 15, 2017, 4:04:18 AM11/15/17
to Google Web Designer beta
I would like to have a creative with a dynamic exitUrl. The exitUrl of DFP-ad should change depending on in where the creative is displayed.

In DFP Hard coded "setTargeting("city"="city_name")" per page works OK for targeting already. And I was thinking if it was possible to use this targeting key&value also for creating dynamic exitUrl - just by adding value into the basic exitUrl.

But for some reason I cannot get the key-value in the creative. I tried to get it with Enabler.getParameter('city') but for some reason it just return always 'null'. Maybe I am using totally wrong method for getting parameters in the creative? All tips are very welcome!

I used Google Web Designer for making the creative and followed more or less these instructions for building up this currently not working dynamic exitUrl (with exception that I was hoping to get and use googletag's setTargeting-key-values in url).

"Combine the dynamic exit URL and suffix in Google Web Designer" (https://support.google.com/richmedia/answer/2664807?hl=en)
---------------------------------
Click the Tap Area where you want to apply the dynamic exit and suffix to.
Add a new event (click the "+" button on the events panel).
Select Tap Area > Touch/Click on the Event step.
On the Action step, select Custom > Add custom action Add custom action.
Add a function name, then paste the following custom code in the text area. Replace the example exit URL with your own exit URL.
Click OK.
// Replace 'https://yourURL.com' with your own exit URL.
var exitURL = 'https://yourURL.com';
var urlSuffix = Enabler.getParameter('exit_suffix');
var symbol = (exitURL.indexOf('?') > -1) ? '&': '?';
if (urlSuffix) {
while (urlSuffix.charAt(0) == '?' || urlSuffix.charAt(0) == '&') {
urlSuffix = urlSuffix.substring(1);
}
if (urlSuffix.indexOf('?') > -1) {
urlSuffix = urlSuffix.replace(/\?/g, '&');
}
}
exitURL = exitURL + symbol + urlSuffix;
Enabler.exitOverride('exit', exitURL);

Kent Myers

unread,
Nov 15, 2017, 6:00:40 PM11/15/17
to Google Web Designer beta
Adding a link to a blog post, not about DFP but hoping it will help: 

Creating custom exits for dynamic remarketing creatives


Kent
Google Web Designer team
Reply all
Reply to author
Forward
0 new messages