The Most Common Configuration

The example below is applicable to a website with one number group. The tracking script will replace the main number that is prominently displayed in the header, and then find all other occurrences of the main number (that might exist in text, footers, etc), with the dynamic number. In this example the main number that will be replaced is 1300 012 345, the phone number in the header is wrapped in an element with ID header-phone, and the name of the number group is main.phoneNumber. While the call to replaceById is not required, it improves the speed of number switching to the extent where the user often cannot notice number switching occurring at all, which works to improve the user experience.

<script type="text/javascript">
var _ctq = _ctq || [];
_ctq.push(['setSiteId', 'FD-01234567']);
_ctq.push(['requires', ['main.phoneNumber']]);
_ctq.push(['replaceById', 'header-phone', 'main.phoneNumber', '#### ### ###']);
_ctq.push(['replaceText', /1300\s?012\s?345/g, 'main.phoneNumber', '#### ### ###']);
_ctq.push(['trackPageView']);

(function() {
    var wca = document.createElement('script'); wca.type = 'text/javascript'; wca.async = !0;
    wca.src = "//web-call-analytics.com/wca.js";
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(wca, s);
})();
</script>