Another way to set up our numbers insertion script includes Google Tag Manager.

First, check if you integrated the web page with Google Analytics using Google Tag Manager.

Here's how you can do this:

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

  2. When you see the web page code, click on Ctrl+F and enter "www.googletagmanager.com/gtm.js" in the search line.

  3. If you didn't find it, go to your GTM account and generate the script for your web page. Once you've done it, you can copy it and insert it into your web page code. Here're some tips for installing your Google Tag Manager code to the web page from Google.

  4. When you've set the GTM code to your site, create a new tag for setting Google Analytics on your web page via Google Tag Manager.

If you've already set the GTM script and published Google Analytics on your web page, go to the next step and implement the number insertion script by creating a tag for it.

Setting the number insertion script using Google Tag Manager

1. Creating a new variable with the script

  1. Go to the required workspace, and in the "Variables" menu, create a new one by clicking the "New" button.

  2. Name the variable with an appropriate title. For example, it can be "Ringostat CallTracking". Then click "Variable Configuration".

  3. Then select a variable type as "Custom JavaScript"

  4. Copy the adapted numbers insertion script to the HTML-editor

    function () {
    var p = [];
    function _h(){p.forEach(function(a){window.ringostatAnalytics.sendPayload(a.type,a.payload)})};
    function _i(a,b){"loaded"===a.readyState||"completed"===a.readyState?b():setTimeout(function(){_i(a,b)},100)};
    function _c(c,d,a,b){window.ringostatAnalytics||(window.ringostatAnalytics=1,b=c.getElementsByTagName("script")[0],a=c.createElement("script"),a.async=!0,a.src=d,a.onload=_h,_i(a,_h),b.parentNode.insertBefore(a,b))};
    return function (t) {
    if(!0===t.get("ringostatTracker")) return;
    var _o = t.get("sendHitTask");
    t.set("ringostatTracker", true);
    _c(document, 'CLIENT_SCRIPT_URL');
    t.set('sendHitTask', function (m) {
    _o(m);
    "object"===typeof window.ringostatAnalytics?window.ringostatAnalytics.sendPayload(m.get("hitType"), m.get("hitPayload")):p.push({type:m.get("hitType"),payload:m.get("hitPayload")});
    });
    }
    }

  5. Then сhange the parameter "CLIENT_SCRIPT_URL" to the numbers insertion script link. Go to your project in Ringostat and find the required link in the "Insertion script" => "Script settings menu".


  6. After you find the link to the script, get back to your Google Tag Manager to the variable "Ringostat CallTracking" you've created before. Find the CLIENT_SCRIPT_URL parameter in the template of the numbers insertion script, put this link instead of this parameter, and "Save".

2. Attaching the variable to the Universal Analytics Tag

Go to the Tags page and select the Google Analytics tag with the "All Pages" or "Object Model (DOM)" firing triggers

Then check "if the option override settings individual fields from the settings variable" in this tag is enabled:

1. The option is enabled.

  1. Select "More Settings" => "Fields to Set" => "+Add Field":

  2. Name the field strictly "customTask":

  3. In the "Value" field, select the previously created variable — "Ringostat CallTracking"

  4. And "Save":

  5. The last step is to publish the changes. Click "Submit" and "Publish".

2. The option isn't enabled.

  1. Create a new field in Google Analytics settings:

  2. Select "More Settings" => "Fields to Set" => "+Add Field"

  3. Name the field strictly "customTask":

  4. In the "Value" field, select the previously created variable — "Ringostat CallTracking".

  5. And "Save".

  6. The last step is to publish the changes. Click "Submit" and "Publish".

Did this answer your question?