Hi,

This is jQuery related so bear with me!

I'm CCing someone who asked about this recently as I think this may help 
them. Apologies to you if this is out of turn :)

I was recently asked by a client to implement cross domain link 
tracking. Fair enough, Google does this in their analytics system, 
however there are several limitations to this:

1. Their link tracking does not support target="blah" attributes of a 
elements.

2. Their link tracking does not simply plug in to optional popup windows 
(degrading nicely if no J/S)

3. Their form tracking does not work with GET forms (despite their 
claims that it does).

NB for point 3. I found, in testing, that their function manipulates the 
action= attribute of the form to include the necessary GET arguments. I 
found that everything after the ? is stripped off a GET form's action 
attribute - at least in FF2/3 and Konquerer. The correct solution is to 
append hidden elements to the form prior to submission.



I have "solved" all of these issue and implemented an example (attached 
- hopefully) that shows the various methods in action with lots of comments.

I use jQuery primarily for its event handling and registration stuff.

I use the order of the event registration strategically, but I 
appreciate that there is no guarantee that the order of registration 
will be preserved through to invocation. It does seem to work in practice.

There are a couple of tweaks for IE due to the fact that it does not 
pick up on an altered href during a click handler that allows bubbling 
up. On the whole it worked for me on FF2/3 and IE 6/7. I didn't do 
further testing.

I hope this helps some people :)

Col
Title: Google Analytics Proper Form Tracking + jQuery and Popups

Here is a link of class gaTrackLink: Hello

Here is a link of class gaTrackLink with target=_blank: Hello

Here is a link of class gaTrackLink that pops up: Hello

Below is a form of class gaTrackForm via GET

Below is a form of class gaTrackForm via POST

Reply via email to