views:

123

answers:

2

Hay All.

I'm currently working on a 'checkout' system, the actual payment and stuff is done by a third party.

When a user checks out using a form it sends all the GET data to some other site, lets call this 'checkout.com'. So the query string is 'checkout.com?var=1&var2=2'.

What i want to do is put a page between my form and this call to checkout.com, i want to be able to log this with google analytics.

Can i use "header("location: checkout.com")"? or will the javascript not get called to log the page?

Do i need to use a HTML redirect? or a javascript redirect? or will the php redriect work properly?

Thanks

A: 

if you are using redirect the browser won't execute the javascript, you have better to use window.location = 'checkout.com'; and call the google analytics script before.

for exemple

pageTracker._trackPageview('url of this page');
window.location = 'checkout.com';

checkout this page for more information

RageZ
However if a use then clicks 'back' in their browser they keep getting forwarded to 'checkout.com'?
dotty
yes but that's a behavior you cannot really avoid. if you wanna keep the google analytics approach it might be better to do some logging on your own database.
RageZ
+1  A: 

Otherwise you could create a Google Analytics event tracking on the link that the user clicks / the form that the user fills out, in order to track the form submit / click.

See http://code.google.com/apis/analytics/docs/tracking/eventTrackerGuide.html

phidah