Retrieving query string parameter values using JavaScript
From Market Ruler Help
__CR.query is a function which takes two parameters and retrieves the string value of the query string parameter.
__CR.query = function (name, default_value) { ... }
The name is the exact name of the query string variable to retrieve. The default value is returned (or null if no default is supplied) if the query string is not found in the current page URL.
Examples will explain its usage best. While visiting the page http://www.example.com/landing/?Source=ppc&product_id=6238751238&s=home+remedy:
<script> __CR.query("Source"); # value is "ppc" __CR.query("product_id"); # value is "6238751238" __CR.query("s"); # value is "home remedy" __CR.query("campaign", "default campaign"); # value is "default campaign" </script>
Using this within the tracking calls would be, for example:
<script> __CR.track("contact", null, __CR.query("email", "-no-email-")); </script>