Dynamic Variable using Doubleclick

694 views
Skip to first unread message

Conall McMenamin

unread,
Aug 2, 2016, 12:54:17 PM8/2/16
to Google Web Designer beta
Hi all,
How can I reference a Dynamic property (from Doubleclick) as a Var?

Using GWD I have bound all the relevant html content to the dynamic feed.

However I want one property to act as a variable (boolean) that controls a function:

it is pulled into the enabler as the below

          devDynamicContent.Flybe_1705_dynamic_300x250[0].extra_frame = false;

I tried 

var extra_frame = (dynamicContent.Flybe_1705_dynamic_300x250[0].extra_frame);
            console.log(extra_frame);


To no avail, help welcome.

Jaz

unread,
Aug 3, 2016, 3:06:17 PM8/3/16
to Google Web Designer beta
Hi Conall,

I saw your Tweet and also assigned a Test Engineer to take a look. We might need to sync with DoubleClick on this, but we'll keep you updated!

thx
jaz
Program Manager
Google Web Designer

Conall McMenamin

unread,
Aug 4, 2016, 10:10:02 AM8/4/16
to Google Web Designer beta
Thanks Jaz, The DoubleClick support team are aware as well. 
Hope to hear back soon! 

ewschang

unread,
Aug 4, 2016, 5:40:45 PM8/4/16
to Google Web Designer beta
Hi Conall,

In your example, I see the name (dynamicContent) in your variable does not match the name used in the dynamic feed(devDynamicContent)... I wonder if it is just a typo when you copy and paste the codes?

I think the correct codes should probably look like: 

<script type="text/javascript">
    var extra_frame = (devDynamicContent.Flybe_1705_dynamic_300x250[0].extra_frame);
    console.log(extra_frame);
</script>

Also, I think you have to put you variable after the Dynamic feed, for example, in code view:
......
<script type="text/javascript" id="h5GeneratedCode">
    Enabler.setProfileId(1234567);
    var devDynamicContent = {};
    ......
    ......
    ......
    Enabler.setDevDynamicContent(devDynamicContent);
</script>
......
<script type="text/javascript">
    var extra_frame = (devDynamicContent.Flybe_1705_dynamic_300x250[0].extra_frame);
    console.log(extra_frame);
</script>


Hope this helps.

Thanks,
Emily (GWD Team)

Conall McMenamin

unread,
Aug 5, 2016, 5:39:32 AM8/5/16
to Google Web Designer beta
Hi Emily,
As mentioned I have been in contact with the Doubleclick studio team (UK). 

Although the content is written as devDynamicContent DCS pulls in the live data form the feed as dynamicContent. 
So var extra_frame = dynamicContent.Flybe_1705_dynamic_300x250[0].extra_frame; Was actually correct. the problem seems to be that I had made this call before the Enabler had actually been initialized, thus it was not registering any values and giving me the console error.

By putting this in the handleWebComponentsReady function (bottom of code view) it seems to have solved this problem. 

However, The problem now seem to be that the functions fired by timeline 'events' are done in such a way that it is unable to reference var extra_frame. I am assuming that they will also need to be moved to after the Enabler has been initialized which is problematic as I will have to unpick how the auto generated event code works. 

Thanks for your help, Hope we can all work together for a solution!


Conall McMenamin

Design Lead, Precision Marketing, Starcom Mediavest Group


Conall McMenamin

unread,
Aug 9, 2016, 7:10:34 AM8/9/16
to Google Web Designer beta
*Solved*

Any dynamic variables need to be defined in the "Ad initialised" function. Then they can be accessed elsewhere in the code/timeline. Other methods seem to fall apart once the creative is loaded in Doubleclick studio. 

simply define a variable using the events panel, document.body > Google Ad > Ad initialized, then create a custom function referring to the dynamic component with "dynamicContent." rather than "devDynamicContent."

Thanks guys 
Reply all
Reply to author
Forward
0 new messages