I want to pass referring URL as an attribute to DFP. I believe if I were to build a custom module and use google_admanager_add_attribute that would prevent my page caching from functioning, as each visitor should have a different referring url, and therefore would require different HTML, therefore preventing the page from being cached. I believe I avoid this issue by passing back the referring URL information client side via javascript, versus server side.
In order to do this, I need to ensure my GA_googleAddAttr is called at the right point in the scripts execution - after the first call to DFP is made, but before the call to display the ads is made - any idea how I would go about doing this via the Google Ad Manager module?
Comments
Comment #1
jcisio commentedYou set your value first. Then in your module, use
google_admanager_get_js()to insert pure JS code in the attr section.Comment #2
newmediaist commentedWhat hook_ would be the best place to put the call to google_admanager_get_js(), hook_boot() ?
Comment #3
jcisio commentedI don't know. It depends. Test and see.
Comment #4
newmediaist commentedI've been testing and can't seem to get it to work; My code is as follows:
Although Drupal does not throw any errors, the JS code is not being inserted into the page... I've also tried hook_boot and hook_preprocess_page with no success - any suggestions are appreciated!
Comment #5
newmediaist commentedAlso, why do you recommend using google_admanager_get_js rather than google_admanager_add_js when what I want to do is add JS?
Comment #6
newmediaist commentedJust wanted to follow up to let anyone reading this post down the road that the following code worked for me:
Comment #7
jcisio commentedI take this chance to fix the wrong description of google_admanager_add_js() where the 'attr' section was missing.
Comment #8
jcisio commentedYes, and of course it was a spelling mistake in #1.