Board Logo

Inserting code for Google Analytics tracking across domains
Bewildered - 9/22/2008 at 08:49 PM

I'm using Tigra Menu Gold on a multi-domain site, and I want Google Analytics to track users across the domains. This is described on...

http://www.google.com/support/analytics/bin/answer.py?hl=en&answer=55503

Item 2 on this page says...

2. Next, you'll need to add the _link function to any links between the domains. Please note that your analytics tracking code and calls to _gat._getTracker (shown in Step 1) must be placed on the page above the call to _link. If your current links look like:

<a href="https://www.secondsite.com/?login=parameters"> Login Now</a>

change them to:

<a href="https://www.secondsite.com/?login=parameters" onclick="pageTracker._link(this.href); return false;">Login Now</a>

Basically, they are saying that in addition to the href attribute, the A tag should contain this attribute...

onclick="pageTracker._link(this.href); return false;"

Of course, The Tigra menu doesn't use A tags or href attributes. The code in Items.js for a typical button in my Tigra menu is like this...

[['<img src=http://mysite.com/menu_files/bgmnav-about-off.jpg>', '<img src=http://mysite.com/menu_files/bgmnav-about-on.jpg>','<img src=http://mysite.com/menu_files/bgmnav-about-on.jpg>'], 'http://mysite.com/about-sitesubject.cfm', {'sw':75},
['About Us', 'http://mysite.com/about-sitesubject.cfm'],
['Our Mission', 'http://mysite.com/sitesubject-mission.cfm'],
['Our Approach', 'http://mysite.com/sitesubject-approach.cfm'],
['Industries & Clients', 'http://mysite.com/sitesubject-industry-client-experience.cfm'],
],

So my question is, how would I add...

onclick="pageTracker._link(this.href); return false;"

...to the links in this code as instructed by Google?

(I notice that the Tigra files -- menu.dom.js, menu.js, menu.opr.js, and menu.lay.js -- all contain "onclick". So I'm guessing that I need to tuck the Google onclick in with the onclick that's already in these files. Exactly how do I do that?)

Thank you.


tigra - 9/22/2008 at 10:17 PM

Tigra Menu Gold does use <a href="..."> (you can find that code in menu.dom.js, menu.lay.js and menu.opr.js) but onclick is already taken.

try replacing
onclick="return menus['',this.TM1O.id,''].exec('',this.id,'',0)"
with
onclick="pageTracker._link(this.href); return false;"
in all three files


Softcomplex: http://www.softcomplex.com/
Back to forum: http://www.softcomplex.com/forum/