Difference between revisions of "When do I use different JavaScript tracking methods?"
m |
|||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
ConversionRuler offers three ways of tracking actions using JavaScript on your web site, they are: | 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 |
This article should disambiguate when to use which tracking upon installation of ConversionRuler. | This article should disambiguate when to use which tracking upon installation of ConversionRuler. | ||
Line 9: | Line 9: | ||
==Why different forms of tracking?== | ==Why different forms of tracking?== | ||
− | [[ | + | [[__CR.link]] and [[__CR.submit]] were added solve some specific issues with FireFox and Safari browsers when downloading binary files (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 19: | Line 19: | ||
So, when you link from: | So, when you link from: | ||
− | http://www.example.com/download-form.html | + | <nowiki>http://www.example.com/download-form.html</nowiki> |
to | to | ||
− | http://www.example.com/files/Brochure.pdf | + | <nowiki>http://www.example.com/files/Brochure.pdf</nowiki> |
The tracking doesn't gets invoked, because of a bug. So, we added two new calls to fix these issues, one for forms, and one for links. | The tracking doesn't gets invoked, because of a bug. So, we added two new calls to fix these issues, one for forms, and one for links. | ||
Line 29: | Line 29: | ||
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 the bug does not occur. | 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 the bug does not occur. | ||
− | ==When to use | + | ==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 [[ | + | When a user clicks on a link which is [[__CR.link]]-enabled, it: |
# Tracks the action with ConversionRuler ... | # Tracks the action with ConversionRuler ... | ||
Line 41: | Line 41: | ||
This solves the bug in all browsers. (The bug is present in FireFox and Safari.) | This solves the bug in all browsers. (The bug is present in FireFox and Safari.) | ||
− | In prior versions of the tracking, you could use [[ | + | In prior versions of the tracking, you could use [[__CR.track]]: |
− | <a href="/page.html" onclick="return | + | <a href="/page.html" onclick="return __CR.track(2)">Track link with action 2</a> |
or | or | ||
− | <a href="/page.html" onclick="return | + | <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 [[ | + | 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 | + | ==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 [[ | + | 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 ''' | + | 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 the submit button | ||
Line 64: | Line 64: | ||
* The user clicking '''Go''' on their cell phone browser interface | * The user clicking '''Go''' on their cell phone browser interface | ||
− | If you simply instrument tracking by adding " | + | If you simply instrument tracking by adding "__CR.link" to the buttons in a form, you will not get the keyboard submissions. |
− | ==When to use | + | ==When to use __CR.track== |
− | [[ | + | [[__CR.track]] should be invoked when: |
* Tracking landing pages, or | * Tracking landing pages, or | ||
Line 80: | Line 80: | ||
* [[JavaScript onclick]] | * [[JavaScript onclick]] | ||
* [[Tracking Links (JavaScript)]] | * [[Tracking Links (JavaScript)]] | ||
− | * [[ | + | * [[__CR.submit]] |
− | * [[ | + | * [[__CR.link]] |
− | * [[ | + | * [[__CR.track]] |
[[Category:ConversionRuler]] | [[Category:ConversionRuler]] | ||
Line 89: | Line 89: | ||
[[Category:ConversionRuler JavaScript Functions]] | [[Category:ConversionRuler JavaScript Functions]] | ||
[[Category:ConversionRuler Installation]] | [[Category:ConversionRuler Installation]] | ||
+ | [[Category:Needs Review]] |
Latest revision as of 16:55, 17 May 2018
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
This article should disambiguate when to use which tracking upon installation of ConversionRuler.
Contents
Why different forms of tracking?
__CR.link and __CR.submit were added solve some specific issues with FireFox and Safari browsers when downloading binary files (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 forms, and one for links.
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 the bug does not occur.
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.
When to use __CR.track
__CR.track should be invoked when:
- Tracking landing pages, or
- Loading the page itself should record an action, or
- For JavaScript AJAX calls on the page
- For any other situation which is not a form and not a link