Named Actions

From Market Ruler Help
Revision as of 20:50, 14 October 2016 by Admin (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
ConversionRuler-Action-Edit-Code-By-Name.png

As of February 2013, you can use action names instead of numbers for your actions in ConversionRuler. The usage is almost identical in ConversionRuler, except that you must pass action codes in quotes when passed to ConversionRuler. It simply makes it easier to associate the actions with their meaning in the JavaScript code.

So, for example:

<script type="text/javascript">
   __CR.track('order', '$129.99', '#571298120');
</script>

Is far simpler to understand than:

<script type="text/javascript">
   __CR.track('3', '$129.99', '#571298120');
</script>

You must quote actions passed to __CR.track (unless you are actually passing a variable - for advanced JavaScript marketers.), so,

<script type="text/javascript">
   // ERROR DO NOT DO THIS
   __CR.track(order, '$129.99', '#571298120');
</script>

will produce an error and will not track.

Action names:

  • Do not have to match by case to track correctly (so, "Order", "order", and "oRdEr" are considered identical)
  • Can have spaces in them, but not at the beginning or end
  • Should avoid using quotes, although technically they are allowed (so, "they're leaving" is valid, although we suggest avoiding it for JavaScript syntax errors.)

The named actions functionality was rolled out simultaneously with the Tracking Queue functionality for AJAX applications. So, an alternate way to use named actions is:

<script type="text/javascript">
   _crq.push(['order', '$129.99', '#571298120']);
</script>

Before you rename everything

Before you rush out and rename all of your actions, please note that any existing tracking code which uses the old action numbers (e.g. 1,2,3,4, etc.) will suddenly break when you change your actions to use a new name. So use action names for new installations, or for when you know that you no longer need to use an old action.