Tracking by ID (JavaScript)
The __CR.track_id call in ConversionRuler is is used to track when the mouse is clicked on a particular ID within an HTML page, and can be used to track Flash advertisements, non-link elements, or link elements.
Contents
Function parameters
The __CR.track_id' function is identical to __CR.track but with an additional, first parameter which is the ID of the element to track.
function __CR.track_id("id-to-track", "action_code", "action_reference_1", "action_amount_1", "action_reference_2", "action_amount_2", ... 4 additional tracking parameters)
You should call this function after the Tracking Snippet is invoked on the page.
Similar to the __CR.track you can pass up to four text values and four amounts to ConversionRuler to be stored along with the action that a visitor has taken.
In addition, if any of the variables are defined in the global scope:
- cramount or cramount0
- cramount1
- cramount2
- cramount3
- crtext or crtext0
- crtext1
- crtext2
- crtext3
They will be passed to ConversionRuler when the element on the page is clicked.
Example 1: Passing values explicitly
Our page contains the following HTML:
<div id="advertisement"> <script type="text/javascript"> var ad_id = 412623423; ... Flash advertisement code ... </script> </div> ... ConversionRuler Tracking Snippet ... <script type="text/javascript"> __CR.track_id("advertisement", 3, "top-ad", null, ad_id); </script>
Clicks on the div with ID advertisement are tracked, and the reference values "top-ad" and "412623423" (the value of ad_id) are passed to ConversionRuler if the visitor clicks the ad.
Example 1: Passing values using globals
Our page contains the following HTML:
<div id="advertisement"> <script type="text/javascript"> var ad_id = 412623423; var crtext0 = "top-ad"; var crtext1 = ad_id; ... Flash advertisement code ... </script> </div> ... ConversionRuler Tracking Snippet ... <script type="text/javascript"> __CR.track_id("advertisement", 3); </script>
Clicks on the div with ID advertisement is tracked, and the reference values "top-ad" (crtext0) and "412623423" (crtext1) are passed to ConversionRuler if the visitor clicks the ad.
This method of passing values to ConversionRuler may be more error prone with multiple IDs tracked on a page due to the fact that it uses global values.