Difference between revisions of "CR.watchers"
(Created page with "<code>__CR.watchers</code> is a member in the ConversionRuler Global Object, and is of type <code>array</code>. It represents a queue of functions to run, intermittently,...") |
(No difference)
|
Revision as of 23:12, 14 November 2018
__CR.watchers
is a member in the ConversionRuler Global Object, and is of type array
. It represents a queue of functions to run, intermittently, to check for a condition which may exist on the page. The functions in this queue are run several times a second to monitor the DOM and the page for changes to the page which may represent Conversion Actions.
The passed in watcher function will be called several times a second until the function returns the exact value of false
– any other value returned will leave the watcher function in the queue indefinitely, or until the function returns false
.
Example usage:
<script> __CR.watchers.push(function (cr) { if (document.getElementById('message-sent')) { cr.track("newsletter", null, cr.data("email")); return false; } }); </script>
The signature of the function added to this queue is function (cr) { }
, and
The first parameter is the ConversionRuler Global Object (e.g. __CR
) and the value for this
in the passed-in function is typically set to the browser global object window
.
This function should be used when a browser web application or web form modifies the DOM and you need to monitor the DOM for changes.
This function is only available as of September 12, 2018.