: GA - Register a conversion without redirecting to the parameter used in the goog_report_conversion function I have a form which redirects to a third party site. My client wishes to register a
I have a form which redirects to a third party site. My client wishes to register a conversion when this form is submitted.
I've used the click tracking script as described by Google here.
My form's submit button then has the following code:
<input type="submit" value="SUBMIT >" onclick="goog_report_conversion('http://www.example.com/conversion')" />
My assumption was that this would work the same as if someone had landed on www.example.com/conversion, without actually going to that page, and thus my client could configure his GA to register hitting that URL as a conversion.
I assumed that www.example.com/conversion didn't actually need to exist, but I created it as a blank page to be on the safe side.
However, when this onclick event is triggered, it redirects to www.example.com/conversion rather than submitting the form (in Chrome, anyway).
The part of the tracking code causing this seems to be the following:
var opt = new Object();
opt.onload_callback = function() {
if (typeof(url) != 'undefined') {
window.location = url;
}
Is this because I have misunderstood what goog_report_conversion does, and as such should I be looking at a different way to report a click as a conversion? Or is there a configuration option in GA that says to redirect or not redirect to goog_report_conversion's parameter?
Thanks in advance.
More posts by @Murray155
1 Comments
Sorted by latest first Latest Oldest Best
Adding return false; should prevent the link in the onclick from being followed.
eg
<input type="submit" value="SUBMIT >" onclick="goog_report_conversion('http://www.example.com/conversion'); return false;" />
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.