Difference between revisions of "Tracking by ID (JavaScript)"

From Market Ruler Help
Jump to: navigation, search
(Created page with '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 adverti…')
 
 
Line 1: Line 1:
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.
+
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.
  
 
== Function parameters ==
 
== 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.
+
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'')
+
  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.
 
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.
+
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:
 
In addition, if any of the variables are defined in the global scope:
Line 37: Line 37:
  
 
<script type="text/javascript">
 
<script type="text/javascript">
     cr_track_id("advertisement", 3, "top-ad", null, ad_id);
+
     __CR.track_id("advertisement", 3, "top-ad", null, ad_id);
 
</script></nowiki>
 
</script></nowiki>
  
Line 57: Line 57:
  
 
<script type="text/javascript">
 
<script type="text/javascript">
     cr_track_id("advertisement", 3);
+
     __CR.track_id("advertisement", 3);
 
</script></nowiki>
 
</script></nowiki>
  
Line 67: Line 67:
 
* [[Can ConversionRuler track a flash advertisement%3F]]
 
* [[Can ConversionRuler track a flash advertisement%3F]]
 
* [[Tracking Order Amounts]]
 
* [[Tracking Order Amounts]]
* [[cr_submit]]
+
* [[__CR.submit]]
* [[cr_link]]
+
* [[__CR.link]]
* [[cr_track]]
+
* [[__CR.track]]
 
* [[:Category:ConversionRuler JavaScript Functions|ConversionRuler JavaScript Functions]]
 
* [[:Category:ConversionRuler JavaScript Functions|ConversionRuler JavaScript Functions]]
  

Latest revision as of 15:34, 26 February 2016

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.

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.

See also