Posted by zet on September 24, 2010 at 2:51am
11 followers
Jump to:
| Project: | Google Analytics |
| Version: | 6.x-3.x-dev |
| Component: | User Interface |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (duplicate) |
Issue Summary
Why javascript scope option has disapeared ? I want to load google analitycs javascript in the footer as recommended by google.
Comments
#1
No longer recommended in 3.0, see the asyc case for the reasons why the option is gone.
#2
I'm using version 6.x-3.0, and the code is inserted in the footer. I confirmed that it is the asynchronous code, that I'm running the right version of the module, and I ran the database updates, so why is the code still getting placed in the footer?
#3
This is a funny issue now, danrasband :) I wanted the opposite. :)
Thanks Hass. I didn't knew about that. I haven't used analytics for a while.
#4
I just downloaded 6.x-3.0 and it's showing in the footer also.
#5
#6
#7
I am using the 6.x-3.x-dev version from 2010-10-09 and this is still appearing in the footer.
Thanks,
Izzy
#8
Same issue with 6.x-3.0.
Fix: change line 178 of googleanalytics.module from:
<?phpdrupal_add_js($script, 'inline', 'footer');
?>
to
<?phpdrupal_add_js($script, 'inline', 'header');
?>
#9
No, this doesn't work and please do not confuse people with something you have not tested - see #212560: drupal_add_js in hook_footer does not add JS files and Support for Asynchronous Tracking and the following comments. Search for 'footer' and 'header' for the answer why it is NOT possible to add async to header section in D6.
#10
Should the status of this issue be changed from "fixed" to "postponed" if it is a Drupal 6 limitation?
Thanks,
Izzy
#11
Hass, I presume your argumentation for comment#9 is http://drupal.org/node/648284#comment-3023848. However, anywhere I look @ analytics (even at the page w/the code snippet) it is suggested to put the code just before the closing , which seems to work fine with this change. The snippet is displayed in the HTML at the proper place, and results are showing up in Analytics as expected.
Am I missing something?
#12
Again, you cannot add JS to header in hook_footer() in D6. Garbor also confirmed this is too late!
#13
Automatically closed -- issue fixed for 2 weeks with no activity.
#14
Doesn't this warrant specific documentation? I've wasted a fair bit of time today trying to debug why despite updating to 3.0, the Chrome plugin reported asynchronous code was not being used, and Google Webmaster tools were unable to verify the site using the "Link to your Google Analytics account", which specifies:
"You can use this option if your site already has a Google Analytics tracking code that uses the asynchronous snippet." Presumably what they mean is that you have to have a *configured as per the guidelines* asynchronous snippet, which this module is not able to provide. It'd be nice to see that front and centre on the documentation for this module, if my interpretation of this is correct.
#15
Uncheck local caching and clear your caches! Validate again - must work.
#16
Hass, I'm not sure what you're saying. Are you saying that this will result in the ga.js code being placed in the header? Following that procedure (I did have local caching turned on) did not result in any change for me. ga.js still loads in the footer of the page.
#17
Upgraded to latest 3.x-dev as I was running 3.0: no change. JS still loaded in footer. Isn't that what you were saying in #12 hass?
#18
No - local caching makes the tracker validation failing. The tool do not understand the code changes. Could you read the description next to the checkbox VERY CAREFULLY first, please?
#19
Nobody provided a patch within the last 2 months that adds some comments to readme. Closing as there seems to be no interrest to add this docs to the module.
#20
there are 2 kinds of validation:
google analytics validation: this works
google webmaster tools validation: this does not work afaik. can you confirm or deny?
#21
Turn of local caching
#22
it is turned off
#23
OT and I don't know what webmaster tools are doing and why they are broken. Don't worry, the code is correct.
#24
Just wanted to let everyone know I updated the troubleshooting page to include this info, as well as some other issues that can occur on upgrade from 2.x to 3.x. If someone wants to confirm that everything I stated is accurate, that would be great.
#25
Automatically closed -- issue fixed for 2 weeks with no activity.
#26
Just for history, marking as duplicate of #1023384: Moving ga.js to <head>.
As of now it still does not validate correctly with Google Webmaster Tools with or without local caching. Google wants it in the header.
Potential fix that needs testing in the duplicate issue.