It is time for a new Chapter of my DFP Small Business Tutorial.
In Oktober 2011 Google introduced the new Google Publisher Tag for DFP Small Business.
The new Google Publisher Tags has a number of new benefits and improvements over the existing Google Ad Manager Tags including faster page loads due to an asynchronous JavaScript fetch.
This tutorial explains how to set up AdSense using DFPs build in AdSense option by using the asynchronous Google Publisher Tags.
Read more about the new Google Publisher Tags here: DFP goes asynchronous with its new Google Publisher Tag. Time to switch
If you are using the old Google Ad Manager Tags read the old version of this tutorial here: How to set up Google AdSense using DFP Small Business build in AdSense option
In the Chapter How to set up Google AdSense as Line Item using DFP Small Business I told you how to set up AdSense as a Third Party Creative.
I choose this way because the build in AdSense Feature of DFP didn’t offer all the functionality that AdSense provided. Or at least I did not now how to do it. However things have changed.
The build in AdSense Feature of DFP provides everything we need to set up AdSense without the need for creating a lot of Line Items and Creatives and still have the full functionality of the old set up.
So how to use the build in AdSense Feature to display AdSense on your website?
I assume you already set up DFP Small Business to serve Ads on your website which means you created Ad Units and implemented the tags into your HTML source code.
Now go to your Inventory Tab in DFP and select the Ad Unit you want to display AdSense in. Click on override next to “AdSense inventory settings – Disabled”
and check the checkbox before “Maximize revenue of unsold and remnant inventory with AdSense”. This interface should look familiar to you now. Make your AdSense Settings and Styling Settings and click Save.
Now your Ad Unit will serve AdSense Ads on this Ad Unit.
ATTENTION:
Due to changes in DFP Small Business and AdSense Reportings tracking AdSense served via DFP with Custom Channels is no longer possible!
The part below is no longer needed / does not work anymore.
BUT even though AdSense is served now, we still don’t have a Channel attached to the AdSense Ad to track its performance. This was the main reason for me to suggest my first method to serve AdSense Ads as Third Party Creatives. But fortunately there is a way to attach a channel (or other attributes) to AdSense via DFP Tags.
You can override AdSense Settings on a per page and per unit level.
Available keys:
New parameter | Example | Allowed values |
adsense_channel_ids |
271828183+314159265 |
valid AdSense channel IDs, separated by ‘+’ |
adsense_ad_types |
text_image |
text, image, text_image |
adsense_ad_format |
|
468x60_as, 234x60_as, 125x125_as, 120x600_as, 160x600_as, 180x150_as, 120x240_as, 200x200_as, 250x250_as, 300x250_as, 336x280_as, 728x90_as |
adsense_background_color |
#000000 |
hexadecimal colors |
adsense_border_color |
#000000 |
hexadecimal colors |
adsense_link_color |
#000000 |
hexadecimal colors |
adsense_text_color |
#000000 |
hexadecimal colors |
adsense_url_color |
#000000 |
hexadecimal colors |
adsense_ui_features |
rc:10 |
rc:10 for very rounded corners, rc:6 for slightly rounded corners, rc:0 for square corners (default) |
So how do we attach an AdSense Channel to our Ad Unit? First you need to create your Custom Channel in AdSense for this specific Ad Unit. Login to AdSense, go to “My Ads > Custom Channels”.
If you did not create your custom channels yet this is the time to do so. Read this for more information on AdSense custom channels: Different strategies to use AdSense Channels
Next to the channel name for your AdSense Ad Unit you find the Channel ID which is a 10+ digit number, note it down.
Now we need to edit the DFP Small Business Ad Unit Tag that we implemented in our website header to add the custom AdSense Channel to our Ad Unit.
You now have to options
- you can attach one or more AdSense Channels to all Ad Units on the page by using: googletag.pubads().set(“key”, “value”); (see the bottom of this page for an example)
- or you can attach a channel to each Ad Unit on a page individually by using: var slot = googletag.defineSlot(“/1234567/skyscraper”, [160, 600]).addService(googletag.pubads());slot.set(“param”, “value”);(recommended)
For this tutorial I assume that you have more then one Ad Unit on a single page so we choose the second option to attach our AdSense Channel IDs to our Ad Units.
If you want to overwrite other AdSense settings, check the above table for keys and values you can override.
key: adsense_channel_ids
and value is the AdSense Channel ID you noted down earlier.
So this is what your DFP Small Business header Tag (the new Google Publisher Tag asynchronous version) looks like before we attach channels:
<script type='text/javascript'> var googletag = googletag || {}; googletag.cmd = googletag.cmd || []; (function() { var gads = document.createElement('script'); gads.async = true; gads.type = 'text/javascript'; var useSSL = 'https:' == document.location.protocol; gads.src = (useSSL ? 'https:' : 'http:') + '//www.googletagservices.com/tag/js/gpt.js'; var node = document.getElementsByTagName('script')[0]; node.parentNode.insertBefore(gads, node); })();</script> <script type='text/javascript'> googletag.cmd.push(function() { googletag.defineSlot('/1025030/PatFra-LR-1P-First_Aid', [336, 280], 'div-gpt-ad-1319984924533-0').addService(googletag.pubads()); googletag.defineSlot('/1025030/PatFra-LR-1P-Threads-Urology', [336, 280], 'div-gpt-ad-1319984924533-1').addService(googletag.pubads()); googletag.pubads().enableSingleRequest(); googletag.enableServices(); }); </script>
And this is the way you attach AdSense Channels to your DFP Ad Units:
<script type='text/javascript'> var googletag = googletag || {}; googletag.cmd = googletag.cmd || []; (function() { var gads = document.createElement('script'); gads.async = true; gads.type = 'text/javascript'; var useSSL = 'https:' == document.location.protocol; gads.src = (useSSL ? 'https:' : 'http:') + '//www.googletagservices.com/tag/js/gpt.js'; var node = document.getElementsByTagName('script')[0]; node.parentNode.insertBefore(gads, node); })();</script> <script type='text/javascript'> googletag.cmd.push(function() { var slot1 = googletag.defineSlot('/1025030/PatFra-LR-1P-First_Aid', [336, 280],'div-gpt-ad-1319984924533-0').addService(googletag.pubads()); slot1.set("adsense_channel_ids", "38234470929"); var slot2 = googletag.defineSlot('/1025030/PatFra-LR-1P-Threads-Urology', [336, 280],'div-gpt-ad-1319984924533-1').addService(googletag.pubads()); slot2.set("adsense_channel_ids", "3867876929"); googletag.pubads().enableSingleRequest(); googletag.enableServices(); }); </script>
If you want to attach multiple channels to one Ad Unit use + to add more then one channel ID:
slot.set("adsense_channel_ids", "4132147310+4132127310+4132147319");
Take note of the Counter in var slotX and slotX.set
where X is 1,2,3…. depending on the number of Ad Units you have on the page.
Now your DFP Small Business Ad Unit serves AdSense whenever there is no other creative to be served and AdSense is tracked by custom channels.
This way you don’t need to create line items and orders for each of your websites and AdSense Ad Units which should save you a lot of time.
Example for attaching the same AdSense Channel to all Ad Units on a single page:
<script type='text/javascript'> var googletag = googletag || {}; googletag.cmd = googletag.cmd || []; (function() { var gads = document.createElement('script'); gads.async = true; gads.type = 'text/javascript'; var useSSL = 'https:' == document.location.protocol; gads.src = (useSSL ? 'https:' : 'http:') + '//www.googletagservices.com/tag/js/gpt.js'; var node = document.getElementsByTagName('script')[0]; node.parentNode.insertBefore(gads, node); })();</script> <script type='text/javascript'> googletag.cmd.push(function() { googletag.defineSlot('/1025030/PatFra-LR-1P-First_Aid', [336, 280],'div-gpt-ad-1319984924533-0').addService(googletag.pubads()); googletag.defineSlot('/1025030/PatFra-LR-1P-Threads-Urology', [336, 280],'div-gpt-ad-1319984924533-1').addService(googletag.pubads()); googletag.pubads().set("adsense_channel_ids", "38234470929"); googletag.pubads().enableSingleRequest(); googletag.enableServices(); }); </script>
I have a question if you (or someone reading) experience this. I place 2 orders of clients of us in some ad units of my page and for the most of the time it works fine, and then without any change it start to show adsense or a white space.
I understood that adsense only enter if you didn't sell the space so I cannot understand why they appears in that ad unit sold and also why only sometimes. when this happen the image of our customer ad disappear and is not shown even if I refresh the page, only empty space or adsense.
Any idea?
thanks again, Carlotta
can we combine both? Defining var slot1, slot2 etc
And at the same attaching the same channel to every adunit with googletag.pubads().set('adsense_channel_ids' '38234470929');
or do we have to add that "382344...." to each var slot1, slo2 with "+"??
Thanks
do we need to create ad in google adsense and then assing the channels, or it is enough with creating the channels, assign them to ad units, and let DFP publish adsense ads?
BR
I'm trying to use var slot1 but doesn't show me any advertising!
is there any mistake?
googletag.cmd.push(function() var slot1=googletag.defineSlot("/17676156/atbf_728_prova", [728, 90], "div-gpt-ad-1349270454725-0").addService(googletag.pubads());slot1.set("adsense_channel_ids", "0211110617"); googletag.pubads().enableSingleRequest(); googletag.enableServices(); );
THANKS
Just wondering if you have any updates as to how this is working? Has anyone been able to implement multiple channels to ad units using the '+'?
I note that on Google's known issues page that the new Adsense UI will not display reporting data for ad units and custom channels in DFP. Is this statement correct for users?
Lastly, I've read that there are issues of double-counting of impressions in Adsense with people using custom channels. Is this the case?
Would be great to get some clarity around these points before spending many hours creating channels and editing tags!
Thanks!
First of all, thank you for this great tutorial.
I have followed all the steps you pointed out above but I am not getting any data on my adsense channel report:
1.- I created the dfp ad units.
2.- I tagged one page
3.- I created new adSense channels (I see the picture above where targetable option is "no" and I have "yes", might it be that the problem?).
4.- I rewrote the tags code so I added the ad units to the new created adSense channels
5.- I can't see any data on the adSense channel report
6.- I waited 24 hours until I wrote this post :-)
Is there something I am missing? Bassically I am ussing DFP to serve adSense plus some "house adds" on my pages. I want adSense advertisers being able to target this channels as it's been being until now.
Just one more questions... Are the adSense channels and DFP placements same from the advertisers point of view?
Any help would be greatly appreciated.
Again, thank you very much!
Due to changes in DFP Small Business and AdSense Reportings tracking AdSense served via DFP with Custom Channels is no longer possible!
With adSense I created a custom channel and I clicked on "Show this custom channel to advertisers as a target". What is the best way to go when adSense is integrated into DFP?
P.S. As far as I know, allowing advertisers to reach my site through adSense custom channels increase my revenue so that's the reason why I am quite interested in doing so in DFP.
Anyway, try the AdSenseExperts-area for these kind of discussions. It's a better place then comments on a blog ;)
"Copy AdSense targeting
If you maintain targetable channels in your AdSense account, copy site targeting settings from an AdSense channel to continue to generate revenue from AdWords campaigns that are targeting your site."
Would that work? Or does it just generate the code mentioned above, which no longer works?
I came here first through google.
I wanna link more than 2 adesnse account with a my DFP. what is process to adding more than 2 different adsense on single DFP. Is it possible I can manage my two adsense through single dfp SB.
In relation this, I have a question re a possible double counting issue using the custom channel linking. I came across this comment on the DFP forum:
"DFP Backfill numbers will show up in the aggregate performance reports, but not when filtering by ad unit or ad size."
Does this mean that if I link up my DFP ad unit that uses AdSense as the remnant option to an AdSense Custom Channel that the pageviews are counted twice in AdSense aggregate performance reports?
The reason I ask is because I am currently experiencing a sudden rise in the number of Adsense pageviews being reported, 30% or more above the Analytics pageview count. Obviously this is different technology and not ad impression based, but the difference does appear to bear some relationship to the DFP remnant numbers.
Have you had any experience of this?
googletag.cmd.push(function() googletag.defineSlot('/17676156/atbf_728_prova', [728, 90], 'div-gpt-ad-1350394427092-0') .addService(googletag.pubads()); googletag.pubads().enableSingleRequest(); googletag.enableServices(););
.............but when i use the "var slot" it doesn't work
googletag.cmd.push(function() var slot1=googletag.defineSlot('/17676156/atbf_728_prova', [728, 90],'div-gpt-ad-1349270454725-0') .addService(googletag.pubads()); slot1.set("adsense_channel_ids", "0211110617"); googletag.pubads().enableSingleRequest(); googletag.enableServices(););