ConversionRuler Tracking Snippets
ConversionRuler Tracking Snippets are a mix of JavaScript code and HTML code which allows ConversionRuler to track actions of visitors to your site.
The basic layout of the tracking snippet is:
- Script which loads ConversionRuler JavaScript code for each page
- Script which records a landing or an action on a page
- HTML which records a landing or an action in browsers which do not support JavaScript
Each component of the Tracking Snippet can be implemented separately for a website which wishes to implement ConversionRuler tracking in a more modular way.
Script which loads ConveresionRuler
This script is written in such a way that it loads ConversionRuler tracking code based on whether the current page is a http:// or https:// page (Secure or non-Secure). It loads the script from ConversionRuler's servers:
http://www.conversionruler.com/bin/js.php?siteid=Site ID
This script is dynamically generated and is based on the features selected for the Site ID passed through. In addition, this script can take the following additional query string parameters:
- nocache - Integer value which changes how the script returns caching headers. Adding nocache=1 to the script loading API will set caching headers such that the script is loaded upon every page load.
- crcookie - Force the use of a particular cookie for tracking. If a site wishes to use first-party cookies, they can pass the desired cookie to ConversionRuler for recording. The cookie should be a 32-character hexadecimal string containing only the numbers 0 through 9 and A through F, e.g. 324d8a1d3f81e730d5099a48cee0c5b6
Script which records a landing or an action on a page
At present, there are two different methods to record a landing and/or action:
Passing values can be performed by passing values to the Tracking Queue or the cr_track function, like so:
Tracking Queue:
var _crq = window._crq || [];
_crq.push(['clicked-button', '', 'Blue Button']);
cr_track:
cr_track('clicked-button', '', 'Blue Button');
In addition, you can pass values using Tracking Landings and Actions (JavaScript) using application globals:
var crtext0 = "automatically saved when tracking records";
- HTML which records a landing or an action in browsers which do not support JavaScript
This final piece of code in the tracking snippet records the actual transaction for browsers which do not support JavaScript.
It calls into a different script on ConversionRuler servers:
http://www.conversionruler.com/bin/tracker.php?siteid=Site ID&actn=Action Name&crcookie=User Identifier&...
This tracking script takes the following parameters:
- siteid - The Site identifier.
- actn - An action, if any, to record. Can be an arbitrary string but must be configured server-side to record correctly. Specifying no action indicates the action recorded as a landing.
- crcookie - The user identifier. 32-character hexadecimal string. (See description above)
- isjs - Boolean value (0 or 1) which affects what type of content is returned by the tracking script. A setting of 1 will return content type of text/javascript and will contain JavaScript. Otherwise, returns image content.
- nojs - Boolean value which indicates whether the client supports JavaScript or not. Should only be used when invoked from within a <noscript> block.
- v - Snippet version number. Number indicating what version of the snippet is recorded.
- refb - Current page URL.
- referer - Page referrer.
- tu - Top URL (for Frame-based sites)
- same - Force recording of landings from the same domain name (can be set server-side for a site as well)
- Action Variables - Pass cramount[0-4] or crtext[0-4] as part of the tracking URL to record values for an action (requires an action to be passed as well)
Within each URL, including the main URL for the tracking (above) you can pass Landing URL Formatting as part of the:
- Tracking URL (the tracker.php URL)
- Page URL
- Referrer URL
- Top Page URL
ConversionRuler will extract the landing page parameters from the above URLs, in order, until it finds a valid landing.