Embed numbers insertion script with your GTAG
Eugene Zastup avatar
Written by Eugene Zastup
Updated over a week ago

Add the Ringostat number insertion script directly into your web page code to set up call tracking on your web page.

1. Check if you set up the Universal Analytics script.

First, check if you've already inserted the Google Analytics script into your web page code.

  1. Go to your web page. Click the mouse's right button and select "View page source".

  2. Once you open the web page code, click Ctrl+F and enter "https://www.googletagmanager.com/gtag/js" in the search line.

  3. If you didn't find it, you should first set up this script in your web page code.

  4. If you found it — go to the next step and set the number insertion script.

2. Insertion script

  1. Copy the template for the adapted script for this version of Google Analytics:

    <script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXX-Y"></script>
    <script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag('js', new Date());
    gtag('config', 'UA-111111-1', {'send_page_view': false});
    </script>
    <script>
    function initRingostat(){
    if (typeof(ga) !== 'undefined') {
    ga('gtag_UA_XXXXXX_Y.require','ringostat');
    gtag('event', 'page_view');
    (function (d,s,u,e,p) {
    p=d.getElementsByTagName(s)[0],e=d.createElement(s),e.async=1,e.src=u,p.parentNode.insertBefore(e, p);
    })(document, 'script', 'https://ringostat.com/numbers/v4/XX/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.js');
    } else {
    setTimeout(initRingostat,200);
    }
    }
    initRingostat();
    </script>
  2. Instead of UA-XXXXXX-Y put your real Google Analytics source ID.

  3. After that, in the field gtag_UA_XXXXXX_Y change UA_XXXXXX_Y to your real Google Analytics source ID using underscore.

    For example, if your Google Analytics source ID is UA-111111-1, then you should put gtag_UA_111111_1.

  4. Then change https://ringostat.com/numbers/v4/XX/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.js to the script link, which you can find in your project settings.

Your script should look like this after all changes:

Did this answer your question?