Download & Extend

GATC Request Process order is wrong

Project:Google Analytics
Version:5.x-1.6
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Being able to insert custom JS is awesome, however, the custom code gets placed AFTER pageTracker._initData.

I encountered a situation where I needed to set pageTracker._setDomainName(".sitename.com") that has to go BEFORE initData (as well as other vars).

What I did to solve, was to just call pageTracker._initData again right after set domain, so my custom JS field looks like:

pageTracker._setDomainName(".sitename.com");
pageTracker._initData();

From some messages, I found:
http://groups.google.com/group/analytics-help-basics/browse_thread/threa...

It appears it's ok to to call initData again.

Has anyone else encountered this problem, and/or know of any problems calling initData multiple times?

Comments

#1

Status:active» postponed (maintainer needs more info)

Could you please provide a Google documentation about this order requirements!? I cannot find anything and as I know ONLY the _trackPageview() call does all the stuff you are talking about. Until _trackPageview() is called as the very last you are only building an array of variables and _trackPageview() function builds and fires the URL based on all variables to Google GA. Please keep in mind that all the functions are not able to read the cookie of Google as your site is not in the domain ".google.com". You only tell the pagetracker URL what the value becomes next after a pagetracker call.

Also see http://code.google.com/apis/analytics/docs/gaJSApi.html.

If you don't trust this - add a network analyser, Fiddler, LiveHTTPHeaders or Firebug and you will see one "GET" request to Google when _trackPageview() is executed.

#2

Category:support request» bug report

"GATC Request Process" seems to be what you are talking about http://code.google.com/apis/analytics/docs/gaTrackingOverview.html. I'm going to fix this later the day and the next DEV will be available tonight.

#3

Title:setting pageTracker vars BEFORE initData» GATC Request Process order is wrong

#4

Component:User Interface» Code
Status:postponed (maintainer needs more info)» fixed

Thank you for pointing this out. Fixed in D5 and D6.

#5

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

#6

Nevertheless we fixed this - http://code.google.com/apis/analytics/docs/gaJSApi.html#_gat.GA_Tracker_... is deprecated. The line will therefore die.