I’m building a website that uses Google’s DoubleClick for Publishers Ad serving system. Since we have targeted ads for multiple sections of the sites, multiple pages, and articles we have over 30 ad units, usually all with the same name, like:
ad_sports_top_banner_300x250
ad_home_skyscraper_720x90
etc.
When I go to DFP systems and ask to generate tags it usually spits out something like this to add to the :
<script type='text/javascript'>
googletag.cmd.push(function() {
googletag.defineSlot('/1234567/ad_home_skyscraper_728x90', [728, 90], 'div-gpt-ad-1234567890123-0').addService(googletag.pubads());
googletag.defineSlot('/1234567/ad_sports_top_banner_300x250', [300, 250], 'div-gpt-ad-1234567890123-1').addService(googletag.pubads());
and something like this to add where I want the add placed:
<div id='div-gpt-ad-1234567890123-0' style='width:728px; height:90px;'>
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1234567890123-0'); });
</script>
</div>
As far as I could tell most things are pretty obvious, the first 7 digit number is my customer id number, followed by the ad name, followed by a 13 digit ad id.
I have a lot of sections, using multiple templates for the body, head etc, so instead of going into each one and having to manually enter a different code on the header and body I would prefer to generate them programatically using onye the Section Name as a variable, like this:
googletag.defineSlot('/1234567/ad_$SectionNameGoesHere_$TypeOfAdGoesHere', [$width, $height], 'div-gpt-ad-1234567890123-0').addService(googletag.pubads());
The only thing that seems to vary from tag to tags in an unpredictable manner is the 13 digit number that seems to be the tag id. Whenever I pick a different set of ads, google gives me a different 13 digit number. I tested on the site and it works if I the same number everytime, but this feels wrong.
Does anyone knows what does that number stands for? Is there a way I can calculate it, or ignore it?
Thanks.
the 13 digit number is strictly a unique ID for each ad. you can have it be whatever you want and does not interfere with your ad code.
Its strictly used to identify the id of the div that is populating the ad on the page.
I.E:
would need:
hope this helps.