Note: This article describes a deprecated integration method. We recommend you not to use it and use the customTask mehod instead.

This integration is meant for those who're using Google Tag Manager to send data into Google Analytics.

To start collecting hits data you'll need to: 

  1. Create a new Custom HTML tag with the connected plugin OWOX BI Streaming;
  2. Set Tracker Name property = owox in every Universal Analytics tag for which you want to collect data.

How to create a new Custom HTML tag

      1. Select the container in your Google Tag Manager account, go to the section Tags and click New:

      2. Specify the name and the type of the tag;

      3. Copy and paste plugin code from the streaming pipeline page or use the following code, changing the values of UA-XXXXXX-YY (your Google Analytics web-property ID) and sessionIdDimension: ZZ (index of a custom dimension used for sending and storing sessionId):

        <script>
        try {
        // Google Analytics tracker initialization snippet. 
        (function(a,b){a.GoogleAnalyticsObject=b;a[b]=a[b]||function(){(a[b].q=a[b].q||[]).push(arguments)};a[b].l=1*new Date})(window,"ga"); 
        
        // Creating 'owox' tracker that will duplicate original Google Analytics hits to Google BigQuery. 
        ga('create', 'UA-XXXXX-Y', 'auto', {'name':'owox'});
        
        // Define Create Only fields here after you've created a tracker 
        
        // Connecting OWOX BI Streaming plugin to the tracker 
        ga('owox.require', 'OWOXBIStreaming', {sessionIdDimension: ZZ});
        
        // OWOX BI Streaming plugin code 
        (function(){var g=function(e,f){var h=e.get("sendHitTask"),g=function(){function d(c){var b=!1,a;try{window.XMLHttpRequest&&"withCredentials"in(a=new XMLHttpRequest)&&(a.open("POST",k(),!0),a.onprogress=function(){},a.ontimeout=function(){},a.onerror=function(){},a.onload=function(){},a.setRequestHeader("Content-Type","text/plain"),a.send(c),b=!0)}catch(d){}return b}function h(c){var b=!1,a;try{window.XDomainRequest&&(a=new XDomainRequest,a.open("POST",k(!1,location.protocol.slice(0,-1))),a.onprogress=
        function(){},a.ontimeout=function(){},a.onerror=function(){},a.onload=function(){},setTimeout(function(){a.send(c)},0),b=!0)}catch(d){}return b}function g(c){var b,a=!1;try{b=document.createElement("img"),b.onload=function(){},b.src=k(!0)+"?"+c,a=!0}catch(d){}return a}function k(c,b){var a;b||(b="https");a=b+"://"+l.domain+"/collect";c||(a+="?tid="+encodeURIComponent(e.get("trackingId")));return a}var l={domain:f&&f.domain?f.domain:"google-analytics-ru.bi.owox.com",debug:!1};return{send:function(c){var b;
        if(!(b=2036>=c.length&&g(c))){b=!1;try{b=navigator.sendBeacon&&navigator.sendBeacon(k(),c)}catch(a){}}return b||d(c)||h(c)||g(c)}}}();e.set("sendHitTask",function(d){var e;if(f&&0<f.sessionIdDimension)try{e=d.get("clientId")+"_"+Date.now(),d.set("dimension"+f.sessionIdDimension,e),d.get("buildHitTask")(d)}catch(m){}h(d);g.send(d.get("hitPayload"))})},h=window[window.GoogleAnalyticsObject||"ga"];h&&h("provide","OWOXBIStreaming",g)})();
          google_tag_manager[{{Container ID}}].onHtmlSuccess({{HTML ID}});
        } catch(e) {
          google_tag_manager[{{Container ID}}].onHtmlFailure({{HTML ID}});
        }
        </script>
      4. Set Tag firing options to Once per page:

         

Notice:Choosing these settings can lead to discrepancies in page views. The tag is fired according to the sequences in the Universal Analytics tags that track the events.

Now check if all the settings necessary for creating the Google Analytics tracker are set in the tag.

Make sure you've specified in this tag the fields that are requierd when creating the counter since they are ignored in the Universal Analytics tags.

Cross-domain tracking

If you track several domains at once, change the line

ga('create', 'UA-XXXXX-Y', 'auto', {'name':'owox'});

to

ga('create', 'UA-XXXXX-Y', 'auto', {'name':'owox', allowLinker:true});
  1. Set Tag firing to "Once per page":

     

You need to confirm that all the necessary settings for creating Google Analytics tracker are set when creating the tracker within the streaming tag.

Don't forget to define the Create Only fields together with creating a tracker in this tag, because they will be ignored in Universal Analytics tags. 

How to update settings in your Universal Analytics tags

  1. Select the tag you need from the list and change its settings:

  2. Go to Advanced Configuration and set Tracker Name to "owox":

  3. In Google Analytics Tag Sequencing, set the OWOX BI tag to fire first:

After completing these actions, create and publish a new version of the GTM container to activate OWOX BI Streaming plugin on your site.

Was this article helpful?
0 out of 1 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.