CR.watch
__CR.watch is a function in the ConversionRuler JavaScript Global with the following arguments:
-
watchFunctionof type ```function```
watchFunction is a function which takes the ConversionRuler JavaScript Global as its first argument. The return value of this function, when `false` and only when `false` - terminates the watcher function permanently.
A watcher function is run, intermittently, to check for a condition which may exist on the page. This function is run ```several times a second``` to monitor the DOM and the page for changes to the page which may represent Conversion Actions. When implementing a watcher function, make the amount of time spent by your function as small as possible.
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.watch(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 JavaScript Global (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 functionality is only available as of December 31, 2025.