#GTMTips: Automatically Recurring Google Analytics Visits to Snowplow – News Couple
ANALYTICS

#GTMTips: Automatically Recurring Google Analytics Visits to Snowplow


I’m back with another customTask A tip, but this time I’m exploring some new areas. Snowplow just introduced the latest version update, which included (among other things) an adapter to handle Google Analytics payloads. Never heard of Snowplow? It is a set of open source libraries designed to allow you to build your own analytics pipeline, all the way from data collection, through ETL (extract, transform and load), using custom enrichments and JSON schemas, and finally to your data warehouse, where you can then Analyze the data using whatever tools you find best. Everything is designed to run via Amazon Web Services, so you don’t need to invest in local server hardware or hosting services.

Snowplow Pipeline – from https://goo.gl/X9Jfeo

At its core, it’s a full-service, do-it-yourself analytics solution. Snowplow has deservedly gained a lot of momentum over recent years, as more and more companies have matured to the point where they want complete control over their data. And I don’t mean just ownership of the data, but also things like controlling aggregation schemes which have proven to be rather strict in Google Analytics, and being completely occupied with when and how data is sampled and standardized.

Anyway, at some point I will write a proper article on Snowplow – one that deserves it. This time I will show you how to set up the Google Analytics clone/tracker tool, so that you can start simply collecting results in your Snowplow pipeline Take advantage of the payload generated and aggregated by Google Analytics.


X


Simmer . Newsletter

Subscribe to the Simmer newsletter to get the latest news and content from Simo Ahava right in your inbox!

Tip 70: Upload Google Analytics Duplicate to Snowplow

Google Analytics Duplicator hits Snowplow with Google Tag Manager

If you’ve read the release announcement, you might have noticed that the release is basically a Google Analytics plugin, which is easy to add if you use the analytics.js tracking snippet.

Unfortunately, with Google Tag Manager there is no reliable way to load a plugin in Google Analytics tags. This means that you are left with clumsy alternative solutions, such as

  1. A custom HTML tag that you use to load analytics.js and build a tracker with the plugin.

  2. some customTask A hack where the plugin is loaded in the middle of a hit.

The first is difficult because you will need afterwards everyone Your tags use the same tracker name if you want them all to copy payloads to Google Analytics.

The second simply does not work. Even if you can load the plugin into the tracker, Google Analytics will not stop waiting for the plugin to be registered, but will simply send the result before the plugin has time to attach and modify the tracking object itself.

So in this tip, we’re just going to bypass the plugin altogether, and iterate its functions with customTask.

To make everything work, create a file custom javascript variable, call it something like customTask – Snowplow Duplicator, and add the following code inside:

function() 
  // Add your snowplow collector endpoint here
  var endpoint = 'https://collector.simoahava.com/';
  
  return function(model)  model.get('sendHitTask');
    
    model.set('sendHitTask', function(sendModel) 
      var payload = sendModel.get('hitPayload');
      originalSendHitTask(sendModel);
      var request = new XMLHttpRequest();
      request.open('POST', path, true);
      request.setRequestHeader('Content-type', 'text/plain; charset=UTF-8');
      request.send(payload);
    );
  ;

Then you need to edit each individual Google Analytics tag whose data you also want to send to Snowplow.

At this point, if you haven’t done so yet, it’s a good idea to take advantage of the Google Analytics settings variable. Instead of having to modify every single tag, just make the necessary change (see below) in the GAS variable, after which you can add the GAS variable to all Google Analytics tags. useful!

Fields to set in a variable or tag Google Analytics Settings

Anyway, the change you need to make is in progress More settings / Fields to be set From the Google Analytics tags or the Google Analytics settings variable. If you are editing tags directly, you will need to check the “Enable overriding settings on this tag” option to see more settings fields. This is the domain you want to add.

field name: customTask
Values: customTask – Snowplow Duplicator

Remember – change must take place in everyone Google Analytics tags whose data you want to split into Snowplow.

Noticeable! At the time of writing, only Clojure Collector in Snowplow supports the Google Analytics Converter. We hope they release support for Scala Stream Collector soon, which will give you access to nice and trendy Google Analytics data in real time! Make sure to keep an eye on the Snowplow discussion forum – it’s as good a place as any for roadmap information.

This is a great addition to Snowplow, as it allows you to work with parameters and values ​​that are familiar to you, if you have used Google Analytics before. It also allows you to take advantage of existing Google Analytics tracking, so you don’t need to rewrite the tracking setting on your site just to go to Snowplow.



Source link

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button