Log in

View Full Version : Google Analytics code added to external site links


meissenation
02-08-2010, 10:26 PM
Hey guys,

This sounds like it's really easy to do but I don't know how. I know there's other mods that take all e-bay links and rewrite them for profit purposes.

What I'd like to do is add the following to all external website links:
onClick="javascript: pageTracker._trackPageview('/link/linkname');"

That way we can track what links are being clicked from our site.

This ideally would be an add-on to BBR's Google Analytics mod.

Marco van Herwaarden
02-09-2010, 10:06 AM
I would be carefull with implementing an OnClick as this can also lead to irritation with your users.

meissenation
02-09-2010, 11:33 AM
Can you elaborate? What irritation would it cause?

Marco van Herwaarden
02-11-2010, 07:18 AM
A simple example. I am used to Shift-Click to open many threads from the forumdisplay (or New posts page) into a new tab before i go read them all. It is very irritating if you both get a new tab with the requested page, and the main tab does not stay on the forumdisplay listing but also reacts on the OnClick and opens a new page in your main tab also.

meissenation
02-11-2010, 12:07 PM
We're still not on the same page and I don't know where you're coming from with new pages and such. If you click a link that has the above code in the original post, the link functions 100% the same, but the Google Analytics script already running in the header picks up on the fact that the link was clicked and logs it into your Analytics account. No new pages are opened.

I unfortunately don't have a live site with a link to an external page that I can readily edit the HTML for, so I added the code to one of my HTML pages and added it to an internal link... no big deal, just tracking false data.

http://mifbody.com/meetgreet/ and then click on the "Register" link on the left navigation bar. There's no noticeable difference to the end user, but the code is still tracking that it was clicked (you can see it in the source code).