Closed (fixed)
Project:
Google AdSense integration
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
4 Sep 2015 at 10:31 UTC
Updated:
27 Jun 2017 at 08:37 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
dalu commentedComment #3
jcnventuraStill not available to me.
Comment #4
vitchy commentedAvailable for me, it would be great to add support for them.
Implementation guide https://support.google.com/adsense/answer/6245305?hl=en&ref_topic=1307438
Comment #5
jcnventuraStill not available to me. Someone needs to provide a patch, and then other people need to test and review it, since I (the maintainer) can't.
Comment #6
fenstratThe attached patch has Page-level ads working for me. Would be good to get some feedback from others (@vitchy / @dalu).
Comment #7
emilorol commentedJust to confirm patch #6 is working like a charm.
Thank you.
Comment #8
fenstrat@emilorol Great. In that case could you mark this as RTBC?
Comment #9
jwintx commentedPatch #6 is working great for me, as well. Marking RTBC as requested.
Comment #10
jcnventuraI'm pretty sure this is not adding the async tag to the script.. And why call drupal_add_js on the script by itself? This would make better sense as part of the inline script.
The good news is that this seems to have come out of beta, and it's now available to me as well.
Comment #11
fenstrat@jcnventura Well noticed, I'd missed the async tag. Seeing as #1664602: Allow attributes to be passed to drupal_add_[css|js] (SRI) is still not fixed for D7 then yes, putting it inline seems the only option.
Comment #12
jwintx commentedPatch #11 results in the following error in the browser console:
Firefox - SyntaxError: expected expression, got '<'
Chrome - Uncaught SyntaxError: Unexpected token <
for this line:
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>Comment #13
fenstrat@JWinTX hmm sorry about that, helps if I properly test patches! #11 resulted in a nested
<script>tag.The attached fixes that issue. As I noted in #11 drupal_add_js() doesn't (yet) support async so I've used drupal_add_html_head() as a work around.
Comment #14
jwintx commentedPatch #13 is working just fine for me. Thanks @fenstrat!
Comment #15
fenstratGreat, thanks @JWinTX, marking as RTBC based on your feedback as this seems to address @jcnventura concerns in #10.
Comment #17
jcnventuraThanks for the work on this @fenstrat. Even though setting to RTBC on your own patches is not kosher.. But then again, I've done that also, so who am I to judge?
I only did a couple minor change, that simplify maintaining parity with the ad code, and avoids calling both drupal_add_js and drupal_add_html_head.. I bundled everything together exactly as provided by Google, and just called drupal_add_html_head once.
But you should still be able to recognize your code.
Comment #18
fenstratGreat, thanks @jcnventura. Cheers for the commit credit as well.
As for self marking as RTBC, yeah sorry about that. In my defence @JWinTX had already RTBC'd in #9, and gave positive feedback again in #14.
Fair call bundling everything into one drupal_add_html_head() call. Good catch removing the "BETA" status of Async and Page-level ads.
Comment #21
Vic96 commentedUsing this patch, can one prevent the page level ads from being shown on specific nodes?
Comment #22
fenstrat@Vic96 The patch from #13 has already been committed. And no, sorry, this issue didn't add the ability to control where page level ads are displayed, that'd be a new featured to be added in a new issue.