Tracking Script Example

Tracking Script Example

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

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

    • Tracking Script Template

      The JavaScript below contains the template that must be used when setting up the tracking script. <script type="text/javascript"> var _ctq = _ctq || []; _ctq.push(['setSiteId', Site ID]); _ctq.push(['requires', [Group 1, Group 2, ..]]); // Insert ...
    • Overview

      Introduction Configuring the Business 1300 dynamic tracking product requires two primary steps: The provisioning of the service and telephony with Business 1300. The setup of the tracking script on the website. This document is primarily concerned ...
    • Static vs Dynamic Tracking

      Static and Dynamic Tracking, what is the difference and which type of number do I need? Static Call Tracking Static call tracking is the traditional form of tracking, you may also know this as single channel based tracking. Essentially the idea ...
    • Install the Business1300 tracking code with Google Tag Manager

      The Business1300 tracking code needs to be installed on your site in order to start tracking online calls. The quickest and easiest way to install the Business1300 tracking code is using Goole Tag Manager. Getting your Business1300 tracking code You ...
    • Positioning of JavaScript

      Positioning of JavaScript The positioning of the JavaScript depends on whether you are using tag manager. No Tag Manager For no tag manager, place the tracking script in the <head> of the HTML. This will ensure the dynamic numbers switch across ...