Difference between revisions of "Named Actions"
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | [[File:ConversionRuler-Action-Edit-Code-By-Name.png|400px|right]] | ||
+ | |||
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. | 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. | ||
Line 4: | Line 6: | ||
<script type="text/javascript"> | <script type="text/javascript"> | ||
− | + | __CR.track('order', '$129.99', '#571298120'); | |
</script> | </script> | ||
Line 10: | Line 12: | ||
<script type="text/javascript"> | <script type="text/javascript"> | ||
− | + | __CR.track('3', '$129.99', '#571298120'); | |
</script> | </script> | ||
− | You '''must''' quote actions passed to [[ | + | You '''must''' quote actions passed to [[__CR.track]] (unless you are actually passing a variable - for advanced [[JavaScript]] marketers.), so, |
<script type="text/javascript"> | <script type="text/javascript"> | ||
// ERROR DO NOT DO THIS | // ERROR DO NOT DO THIS | ||
− | + | __CR.track(order, '$129.99', '#571298120'); | |
</script> | </script> | ||
Line 33: | Line 35: | ||
_crq.push(['order', '$129.99', '#571298120']); | _crq.push(['order', '$129.99', '#571298120']); | ||
</script> | </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. | ||
[[Category:ConversionRuler]] | [[Category:ConversionRuler]] |
Latest revision as of 20:50, 14 October 2016
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.