Difference between revisions of "When do I use different JavaScript tracking methods?"
Line 7: | Line 7: | ||
==Why different forms of tracking?== | ==Why different forms of tracking?== | ||
− | [[cr_link|cr_link]] and [[cr_submit|cr_submit]] were added solve some specific issues with | + | [[cr_link|cr_link]] and [[cr_submit|cr_submit]] were added solve some specific issues with FireFox and Safari browsers when downloading non-web content (like installers, PDFs and other binary content). |
The issue was, unfortunately, that tracking wouldn't work due to issues with those browsers. | The issue was, unfortunately, that tracking wouldn't work due to issues with those browsers. | ||
Line 13: | Line 13: | ||
==What's the problem?== | ==What's the problem?== | ||
− | + | When the current page opens a new URL to a binary file, tracking doesn't work all of the time. | |
+ | So, when you link from: | ||
+ | http://www.example.com/download-form.html | ||
− | + | to | |
− | + | http://www.example.com/files/Brochure.pdf | |
+ | |||
+ | The tracking doesn't gets invoked, because of a bug. So, we added two new calls to fix these issues, one for when it's a form, and one for when it's a link. | ||
+ | |||
+ | It only happens when the current page URL changes (e.g your address bar changes to a different URL). If the link or form opens up a second window or targets an iframe, then tracking does work all of the time. | ||
==When to use cr_link== | ==When to use cr_link== | ||
Line 47: | Line 53: | ||
[[cr_submit|cr_submit]] was added in order to solve a bug in browsers when submitting a form which results in a binary file download (such as installers, PDFs or executables.) | [[cr_submit|cr_submit]] was added in order to solve a bug in browsers when submitting a form which results in a binary file download (such as installers, PDFs or executables.) | ||
− | It works similarly to how [[ | + | It works similarly to how [[cr_link|cr_link]] works, by first tracking the action, waiting a short delay, then submitting the form manually. '''cr_submit''' always returns false, because it submits the form after tracking is done. |
+ | |||
+ | You should use '''cr_submit''' ''all of the time'' when tracking forms, because it will track forms submitted by: | ||
+ | |||
+ | * The user clicking the submit button | ||
+ | * The user clicking an image button | ||
+ | * The user hitting "Enter" on their keyboard | ||
+ | * The user clicking '''Go''' on their cell phone browser interface | ||
+ | |||
+ | If you simply instrument tracking by adding "cr_link" to the buttons in a form, you will not get the keyboard submissions. | ||
+ | |||
+ | |||
+ | == See also == | ||
+ | * [http://conversion.marketruler.com/setup/codegen.php ConversionRuler Code Generator] | ||
+ | * [[JavaScript]] | ||
+ | * [[JavaScript onclick]] | ||
+ | * [[Tracking Links (JavaScript)]] | ||
+ | * [[cr_submit|cr_submit]] | ||
+ | * [[cr_link|cr_link]] | ||
+ | * [[cr_track|cr_track]] | ||
+ | |||
+ | [[Category:ConversionRuler]] | ||
+ | [[Category:ConversionRuler FAQ]] | ||
+ | [[Category:Technical]] | ||
+ | [[Category:ConversionRuler JavaScript Functions]] | ||
+ | [[Category:ConversionRuler Installation]] |
Revision as of 02:30, 19 July 2011
ConversionRuler offers three ways of tracking actions using JavaScript on your web site, they are:
- cr_track - For tracking landings and actions on page loads
- cr_link - For tracking when visitors click on links
- cr_submit - For tracking form submissions
Contents
Why different forms of tracking?
cr_link and cr_submit were added solve some specific issues with FireFox and Safari browsers when downloading non-web content (like installers, PDFs and other binary content).
The issue was, unfortunately, that tracking wouldn't work due to issues with those browsers.
What's the problem?
When the current page opens a new URL to a binary file, tracking doesn't work all of the time.
So, when you link from:
http://www.example.com/download-form.html
to
http://www.example.com/files/Brochure.pdf
The tracking doesn't gets invoked, because of a bug. So, we added two new calls to fix these issues, one for when it's a form, and one for when it's a link.
It only happens when the current page URL changes (e.g your address bar changes to a different URL). If the link or form opens up a second window or targets an iframe, then tracking does work all of the time.
When to use cr_link
cr_link was added in order to solve a particular bug in browsers when downloading binary files, like installers, PDFs or executables.
When a user clicks on a link which is cr_link-enabled, it:
- Tracks the action with ConversionRuler ...
- Waits 300 microsectods
- Follows the link
This solves the bug in all browsers. (The bug is present in FireFox and Safari.)
In prior versions of the tracking, you could use cr_track:
<a href="/page.html" onclick="return cr_track(2)">Track link with action 2</a>
or
<a href="/page.html" onclick="return cr_link(this, 2)">Track link with action 2</a>
Both tracking forms are still acceptable, but it is generally recommended to use cr_link as it handles all cases accurately for all kinds of links.
When to use cr_submit
cr_submit was added in order to solve a bug in browsers when submitting a form which results in a binary file download (such as installers, PDFs or executables.)
It works similarly to how cr_link works, by first tracking the action, waiting a short delay, then submitting the form manually. cr_submit always returns false, because it submits the form after tracking is done.
You should use cr_submit all of the time when tracking forms, because it will track forms submitted by:
- The user clicking the submit button
- The user clicking an image button
- The user hitting "Enter" on their keyboard
- The user clicking Go on their cell phone browser interface
If you simply instrument tracking by adding "cr_link" to the buttons in a form, you will not get the keyboard submissions.