views:

73

answers:

1

Hello,

I have the following scenario:

  1. The user has an on-site shopping cart where he adds products.

  2. When the user clicks on checkout he is POSTed to a script that computes the buy link to an off-site shopping cart and redirects him with the Location header.

  3. The user continues with the payment in the 3rd party website.

What I need is to track the user throughout this process.

_gaq.push(['_link', this.href]); is for direct links and _gaq.push(['_linkByPost', this]); is for form posts, but what should I use for header redirects?

(Having that Google Analytics updates in up to 48 hours I can't just use trial and error for this.)

Thank you, Alin

A: 

After some investigation and tests I found that it is enough to have _gaq.push(['_setAllowLinker', true]); on both sites and the linking information consists in all the cookies set by GA being appended to the request URL so they are sent to the 3rd party page.

So if your redirect URL is http://www.example.org/shoppingcart/ then you need to read the __utma, __utmb, __utmc and __utmz and append them so that you get http://www.example.org/shoppingcart/?__utma=...&__utmb=...&__utmc=...&__utmz=.... The GA script on the target page will see these GET parameters and use them to identify the visitor.

In the case of _link the script does this for you by adding those parameters to the href supplied and it also loads that computed URL. In the second case, of _linkByPost it appends the parameters to the action attribute of the form.

Alin Purcaru