Mobile app version of vmapp.org
Login or Join
Murray155

: 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

@Murray155

Posted in: #ClickTracking #GoogleAnalytics

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 &gt;" 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.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Murray155

1 Comments

Sorted by latest first Latest Oldest Best

 

@Hamaas447

Adding return false; should prevent the link in the onclick from being followed.
eg

<input type="submit" value="SUBMIT &gt;" onclick="goog_report_conversion('http://www.example.com/conversion'); return false;" />

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme