I have form, let’s say it’s on index.php. On submit, it goes through process.php, then finishes on thanks.php. I want to trigger an Analytics Event so I can track my form (no I don’t want to use a URL Destination). If I put the Event code on thanks.php, I’m concerned that if people refresh the page, it will re-trigger and give me bad results. So, I want it to trigger from process.php somehow. At the end of process.php, I set the header like this:
header('Location: /thanks.php');
This is the code for triggering the Event:
_gaq.push(['_trackEvent', 'ClaimDomain', 'ConfirmationPage']);
Is there some way of sending the JavaScript call along with the header, so that it only gets processed as we leave process.php, and not when we refresh thanks.php?
Thanks for your help 🙂
Not really, PHP is server-side, Javascript is client-side.
From reading about this though, it sounds like it may be a non-issue:
Source: Event Tracker Guide – Actions.
So GA will know if they happen to land on the page twice and it will not count as 2 unique events.