<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Markus Baersch on Medium]]></title>
        <description><![CDATA[Stories by Markus Baersch on Medium]]></description>
        <link>https://medium.com/@mbaersch?source=rss-ca8558a31676------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*hJSmSfJp1I9zGhwU</url>
            <title>Stories by Markus Baersch on Medium</title>
            <link>https://medium.com/@mbaersch?source=rss-ca8558a31676------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 18:41:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mbaersch/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[A Better Solution For GA4 Data Capturing? Replacing gtag.js With walker.js]]></title>
            <link>https://mbaersch.medium.com/a-better-solution-for-ga4-data-capturing-replacing-gtag-js-with-walker-js-2b9fd291d919?source=rss-ca8558a31676------2</link>
            <guid isPermaLink="false">https://medium.com/p/2b9fd291d919</guid>
            <category><![CDATA[ga4]]></category>
            <category><![CDATA[data-collection]]></category>
            <category><![CDATA[bigquery]]></category>
            <category><![CDATA[server-side-tagging]]></category>
            <dc:creator><![CDATA[Markus Baersch]]></dc:creator>
            <pubDate>Tue, 27 Dec 2022 10:06:00 GMT</pubDate>
            <atom:updated>2022-12-27T10:06:00.897Z</atom:updated>
            <content:encoded><![CDATA[<p>If you bet on Google Analytics 4, you can hardly avoid the standard method of data capturing in the browser: gtag.js. Neither with direct implementation, nor using the Google Tag Manager. In most cases, gtag.js transports individual GA4 property settings to the browser, captures data and sends it to Google Analytics… either directly or via a server-side Google Tag Manager.</p><p>Finding a Replacement seems hard — but is not impossible! walker.js offers an alternative which has recently been released in a new version that simplifies its use as a gtag.js replacement. Especially in combination with a server-side GTM you will get a highly versatile data stream that is — not only — suitable for GA4. You can send events to Matomo, Fathom, Plausible… or directly to BigQuery for real first party analysis.</p><h3>Why Walk Away From gtag.js?</h3><p>If gtag.js is the best way to feed GA4 with data: why even think about options? At the end of the day, if you use a ssGTM, you can get gtag.js into the browser as a first party script and bypass many “tracking protection problems” without using another solution. Moreover, gtag.js is the only way to fully support all features and your individual settings in GA4. Thanks to gtag.js, the browser knows about a lot of things that you usually would not expect to be “visible” to the browser:</p><ul><li>What is a conversion?</li><li>Which domains are on the exclusion list?</li><li>What should be marked as internal or dev traffic?</li><li>Which events should be changed or created based on other events?</li></ul><p>Add things like remarketing support (client-side and server-side), storing click-ids, cross domain tracking. Replacing all of that is difficult… and in some aspects nearly impossible.</p><p>Nevertheless, there are some good reasons why an alternative form of data capturing in the browser is desireable. Be it because other scripts are <strong>more lightweight </strong>or to have a solution for reporting events to your own endpoint even if there is <strong>no consent </strong>to use Google Analytics. And without having to use the dubious Consent Mode (honestly: do not use it!).</p><h3>What Is walker.js?</h3><p>walker.js is an open source library for tagging and generating events. At <a href="https://www.elbwalker.com/">elbwalker.com</a> you can find examples, a demo and detailed documentation. I used walker.js for data collection during my “<a href="https://www.youtube.com/watch?v=juzaUNb55t4">First Party Data Workshop</a>” (a German language Youtube video series) to show the possibilities of independent data collection and analysis.</p><p>This is exactly one of the main arguments for not using gtag.js: If you don’t want to send data only to Google Analytics 4 from ssGTM, you will get data on your own endpoint if you a) agree to Google Analytics or b) use Consent Mode. Events and page views for alternative tools such as Matomo, Piwik PRO or even your own database are thus omitted if you can not establish an data stream from the browser, which can and may work <strong>independently of individual consent</strong>. walker.js helps to build a stream of events from the browser that can be easily created and forwarded to ssGTM or other vendors directly from the browser while staying in full control.</p><h3>Using walker.js For Google Analytics 4… And More</h3><p>This article shows how walker.js sends events from a client-side Google Tag Manager, then receives events at a server-side Google Tag Manager, processes them and passes them on to GA4. Or — e.g. in case of missing consent — reports them to other services or stores data directly as raw event data in BigQuery.</p><h3>Part I: Tagging Your Site</h3><p>walker.js supports two different ways to generate events like page views, clicks, scrolls, e-commerce events or anything else that typically needs to be measured on a website or in an app. Event data consists of a predefined but flexible object structure with different keys where the data ends up — either automatically or by configuring the “walker” or events directly.</p><figure><img alt="walker.js event example" src="https://cdn-images-1.medium.com/max/626/1*pNJt3r0G0peymJcKV11Kig.png" /><figcaption>walker.js event example</figcaption></figure><p>The “primary” way to tag is to use attributes in the source code. This system has undeniable advantages, but is rarely feasible for tagging updates on an existing website. Rather, there is usually an established structure, a dataLayer and a tag manager that work together to provide Google Analytics with data. On this basis, the following notes will show an exemplary tagging conversion.</p><p>For most cases, tagging will (have to) be done using JavaScript, without relying on the presence of certain elements on the page, suitably tagged with attributes for walker.js. Therefore, to replace Universal Analytics or GA4 tags in GTM, an <strong>event tag template for walker.js</strong> is the most appropriate solution. Feedback on the workshop and a presentation at Measurecamp Brussels clearly showed that this is the only way to provide a “sufficiently easy” way of integration into existing tracking setups that currently still (have to) rely on gtag.js.</p><h3>Tagging With GTM Event Template</h3><p>In order for walker.js to be essentially exactly the same as integrating any other tracking service, all events can be covered with a new type of event tag. Where a page view, click, or purchase is configured in a tag manager to trigger tags for multiple services, walker.js tagging just adds another tag to the game. In a final state, this tag should replace tagging for a server-side GTM with GA4 tags, but parallel operation is usually recommended for testing and validation. This allows parallel collection data in a <strong>second GA4 property for comparisons</strong> until a switch to walker.js events as the primary data source can proceed smoothly.</p><p>If a tracking is new or completely rebuilt, you can directly go with walker.js and leave out GA4 tagging completely.</p><h3>Tag Template Installation</h3><p>To use the event tag, a manual installation (currently) is required. To do so, download the <em>template.tpl</em> from the <a href="https://github.com/elbwalker/gtm-tag-template">tag template Github repository</a>, create a new entry for a tag template in GTM under “<em>Templates</em>” and then import the saved file via the three-dot menu using “<em>Import Template</em>”. After saving, “<em>walker.js Event</em>” will be available when creating a new tag.</p><h4>Load And Configure walker.js</h4><p>In order for the event to be processed, the walker.js script must be loaded and configured. This can be done in different ways.</p><ul><li>Direct implementation</li><li>Loading and configuring via HTML tag in GTM</li><li>Use of another “walker.js Configuration” template</li><li>Mixed operation of the preceding options</li></ul><p>If you have the possibility to put walker.js on your own server and load it in the source code of all pages and add a second script for configuration — just like you would do if you implement gtag.js or other tracking services directly — you can do this without having data flowing around without your control. This is one of the advantages of walker.js: the order of configuration, occurrence of events, and consent changes do not play a significant role. Right: no race conditions!</p><h4>GTM Configuration Tag Template</h4><p>However, it will be more usual to accommodate the loading and configuration in GTM, because this is what it is ultimately intended for. The additional <a href="https://github.com/elbwalker/gtm-tag-template/tree/main/ressources/gtm-config-tag-template">configuration tag template in the Github repository</a> offers the most comfort for this. The following image shows an example of a Configuration Tag with activated loading of walker.js from a CDN and two different assigned “<em>destinations</em>” (which define what shoud happen with events that occur on a page).</p><figure><img alt="Configuration Tag Template" src="https://cdn-images-1.medium.com/max/786/1*uxRBeBJ4130M1XRbv2NRKw.png" /><figcaption>Configuration Tag Template</figcaption></figure><p>You can benefit from a tag template to load and set up walker.js without handling too much JavaScript code. But because this way needs a bit more explanation, please refer to the <a href="https://github.com/elbwalker/gtm-tag-template/tree/main/ressources/gtm-config-tag-template#readme">help for this template</a> where you can find a documented example configuration, destination code and simple session management code if you prefer to utliize a template.</p><h4>Using a HTML Tag For Configuration</h4><p>This post shows the use of a “Custom HTML” tag instead which contains the base configuration from <a href="https://github.com/elbwalker/gtm-tag-template/blob/main/ressources/example-init-tag.html">the example in the repository</a> instead. With this code, the desired version of walker.js can be loaded, initialized and configured with a “<em>destination</em>” that forwards all events including the current consent state to ssGTM.</p><p>At the top of the script, which is copied and pasted into a new HTML tag in GTM, the configuration customization happens.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/926/1*2MGy9wrN3axfVpVrDaLAMQ.png" /><figcaption>walker.js sample configuration</figcaption></figure><p>Each configuration can be provided with a version via “<em>setup_version</em>”, which will be attached to each event and can be passed as dimension to GA4 if desired. This may be helpful for debugging in case of problems after adjusting the configuration. More essential are the following options.</p><ol><li>The path under “<em>setup_endpointUrl</em>” specifies to which endpoint events should get sent. This should be the address of your server-side GTM including the path for addressing the elbwalker client (see below). Use <em>httpbin.org/anything</em> as a temporaty target for testing, so that every payload is returned by this service and then can be checked in the browser’s network overview.</li><li>The two format options “<em>setup_sendAsImage</em>” and “<em>setup_sendBase64</em>” determine whether a GET (=”<em>image</em>”) or POST request is used and whether the payload should be Base64 encoded. The client (see below) will understand all possible combinations of these settings. They are primarily used to work with GET instead of the usual POST as a fallback in case of CORS problems. In 99% of cases, the existing default settings will be sufficient.</li><li>Specify a “<em>setup_walkerpath</em>” when the tag should load walker.js. The default setting is to load from a CDN — you will probably prefer your own server, which can be done either by entering the path of a local copy or — after installing the client a, ssGTM — also via your own tagging server. For initial testing, just use the CDN address.</li><li>Finally, the placeholder “<em>setup_useSessionData</em>” is responsible for whether and how events will include data about user and session. For this purpose, you can find an example implementation in the script below, which should be adapted for real world use. It utilizes <em>localStorage </em>and <em>sessionStorage </em>and can only be used for a single host (e.g. only <em>www.example.com</em>, but not additionally <em>shop.exampe.com</em> or other subdomains) is involved. If you want to use the existing example, at least all keys used to store data in the browser should be added to your cookie statement (if there is one) and the variable “<em>setup_useSessionData</em>” should only be set to <em>true </em>if there is consent. Accordingly, depending on how this tag is using persistence, the triggering of this setup tag for walker.js needs to reflect user consent.</li></ol><p>After adjusting configuration, the container can be previewed. Per default configuration, firing the configuration tag creates a <em>page view</em> event on every page load. With active logging in the browser’s console (see code), you can see them and the network tab (or the ssGTM preview) show the requests that walker.js sends.</p><h3>Example Events: E-commerce</h3><p>Page views are usually not enough for a tracking setup. While walker.js offers a lot of options to automatically use things like scrolltracking or track visibility of elements, clicks etc., it is more common in a GTM setup that there is a dataLayer and triggers to fire event tags already exist.</p><p>Therefore, two typical examples that occur in an e-commerce setup will be shown here. An “<em>add_to_cart</em>” event will be sent using the walker.js event tag, A “<em>purchase</em>” event is used to demonstrate how a normal HTML tag can fulfill the same task, because under certain conditions, working with JavaScript instead of using a tag template makes more sense and / or is the more efficient solution.</p><h4>Add To Cart (Template Example)</h4><p>To use the tag template for creating an event, the procedure is similar to any other tags: create a new tag, select the “<em>walker.js Event</em>” type and define some properties by filling out a form.</p><p>As a minimal configuration, <strong>entity and action</strong> are required to create a valid elbwalker event. This can be “<em>product</em>” and “<em>add</em>” — the properties (including the event name) for GA4 can be defined separately later (see below).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*39me1bgOHaB7IYdZe_i8tw.png" /><figcaption>walker.js “Add To Cart” event</figcaption></figure><p>A trigger can be selected from a list or defined by variable. The list defaults correspond to the <a href="https://docs.elbwalker.com/tagging/available-triggers">documentation</a>. If you only have GA4 in mind, you can define the trigger with a variable of type “Undefined value” or fill it with any desired value — it will not affect GA4 data.</p><h4>“data” and “context” Objects</h4><p>A walker.js event provides several areas for specific data. For example, there is a “<em>globals</em>” object, which contains all data / properties that are valid for all events on the page. On the other side, a “<em>data</em>” object holds further properties concerning the event itself, e.g. the URL of a page in case of a page view or the transaction ID for a “<em>purchase</em>”. In between lies the “<em>context</em>”, whose data can be valid for a group of events, for example. Refer to the elbwalker website where tagging concepts and structure of walker.js events are explained.</p><p>In general, all those areas can be assigned data in various ways — or left blank. Not all events have additional properties. If data is specified, it always consists of a name “<em>Key</em>” and a value “<em>Value</em>” pair. Definition can be done as JavaScript variable returning an object with the desired data or by using a table (which is more like defining event parameters in a GA4 event tag). In both cases, names can be arbitrarily or be based on the requirements of a GA4 event.</p><p>In the figure above, this is only an “<em>event_name</em>” for GA4 that overrides the “<em>product add</em>” event key that will arrive at the server. This is not the only way to define GA4 event names — the ssGTM client can optionally translate incoming event names. But it is probably both easier to maintain and understand if all parameters are defined in one place.</p><p>If you want to use a JavaScript Variable, you can take a look at the following code, where some parameters are defined for a custom event:</p><pre>function(){<br><br>  return {<br>    &quot;element_id&quot;: &quot;element37&quot;,<br>    &quot;element_name&quot;: &quot;Some random DOM element&quot;,<br>    &quot;is_tag&quot;: 22050000,<br>    &quot;property_x&quot;: {{your variable name here}},<br>    &quot;element_category&quot;: &quot;promo&quot;<br>    };<br>  <br>}</pre><h4>The “nested” Object</h4><p>A walker.js event contains a “<em>nested</em>” array, in which several — possibly nested — elements are contained. This is of course useful to pass product data (in GA4 jargon “<em>items</em>”). The <a href="https://docs.elbwalker.com/tagging/nested-entities">documentation </a>has more details about the format, that uses of a “<em>type</em>” and a “<em>data</em>” object with key/value pairs.</p><p>There are several options to assign data. Besides the already known way of using a variable, the tag can use an ecommerce dataLayer for GA4 (“<em>ecommerce.items</em>”) directly. This makes the conversion especially easy while keeping the existing dataLayer. By ticking an option, these “<em>items</em>” can get converted into walker.js format. The type will be “<em>product</em>” , so that the ssGTM client (see below) can understand data from the “<em>nested</em>” array without any further settings and convert it back to the usual “<em>items</em>” format.</p><p>Note: Yes, it would be possible to place products directly as “<em>items</em>” in the “<em>data</em>” object. This is not intended, but will work. This approach is perfectly fine, as long as you really only want to feed GA4. However, it would be a pity to ignore format specifications, because depending on the further use of the event, you might make processing or validation hard.</p><p>Following these examples, additional e-commerce events can be defined and populated with data in a “GA4 suitable” way. Depending on the purpose, existing triggers already in use for GA4 tags can be used for walker.js events as well. Alternatively, new triggers can be created that always fire regardless of consent, report events to ssGTM where consent is resolved and only services that are allowed to process the event get it. Find more details in the repository readme and the section below about triggers and consent.</p><h4>Purchase (JavaScript Example)</h4><p>Using the event tag template, any other event can be defined and sent. But if you prefer HTML tags instead, this is feasible, whenever it seems more flexible for populating values.</p><p>walker.js works with its own dataLayer, called “<em>elbLayer</em>”, where commands and configuration and events are stored for the “walker” to process. To trigger a new event, information about what happened must be written into the elbLayer. A function for this is predefined in the configuration tag and is called <em>elb()</em>. By using this function a purchase (or any other event) can get into the elbLayer. Here is an example:</p><pre>&lt;script&gt;<br><br>var elb = elb || function () {<br>  (window.elbLayer = window.elbLayer || []).push(arguments);<br>}<br>elb(&quot;order success&quot;,<br>{<br>  transaction_id: {{ecommerce.transaction_id}},<br>  tax: {{ecommerce.tax}},<br>  shipping: {{ecommerce.shipping}},<br>  value: {{ecommerce.value}},<br>  currency: {{ecommerce.currency}}<br>  },<br>&quot;load&quot;,<br>{<br>  event_name: &quot;purchase&quot;, <br>  session_start: false<br>  },<br>{{convert2nested}}({{ecommerce.items}})<br>);<br><br>&lt;/script&gt;</pre><p>Various values such as the transaction ID are populated from <em>dataLayer </em>variables, as they would also serve for a GA4 purchase event. The only special thing here is the conversion of products via a function “<em>convert2nested</em>”, which must be created as a separate variable. The code of this function, which transforms items to the “nested” format for walker.js:</p><pre>function() {<br>  return function(eec) {<br>    var src = eec;<br>    if (!eec || typeof(eec) !== &quot;object&quot;) return [];<br>    <br>    //do we have items / products or a complete ecommerce object?<br>    if (eec.ecommerce &amp;&amp; eec.ecommerce.items)<br>      src = eec.ecommerce.items;<br>    else<br>      if (eec.items) src = eec.items;<br>    if (!src || !Array.isArray(src)) return [];<br>    try {<br>      return src.map(function(x){<br>        return {<br>          type: &quot;product&quot;,<br>          data: x<br>          }<br>      });<br>    } catch(e) {<br>      return [];<br>    }<br>  }<br>}</pre><p><strong><em>Note</em></strong>: In the <a href="https://github.com/elbwalker/gtm-tag-template#purchase">repostory help</a> you can find a “<em>purchase</em>” example that is created using the event tag template instead.</p><h3>Options For Triggers And Consent</h3><p>Consent infomation might play a special role in this concept, which will can found in different places depending on the use. If you use consent functions from walker.js, you will find the current state for each event inside the “<em>consent</em>” object.</p><p>If you already manage consent information in other ways in GTM, you can optionally add it as “<em>globals</em>” field(s) and evaluate consent on the server. There might be consent cookie values present in the header of a tracking request. Depending on whether you always send events from the browser and then resolve consent on the server, or if events are only generated when consent is given, server-side triggers can use consent data. As long as consent conditions are available as event parameters or somewhere else, you can access them on the server and respect the user´s choice.</p><h3>Part II: Receiving walker.js Events With Server-Side GTM</h3><p>After creating events in the browser in the desired form, they now have to be received and prcessed on the server in order to make them available to tags. For this purpose a custom client template is used, which first has to be installed in ssGTM. The template file can be found in a <a href="https://github.com/elbwalker/sgtm-client-template">separate repository</a> and is installed as a client template in the exact same way as for browser-side GTM templates before.</p><p>The new template can then be used to create a client in the container that will react to walker.js events.</p><h3>Configuring The Client</h3><h4>Serving walker.js From Your Own Server</h4><p>In addition to receiving events, the client can be used to serve the tracking script through your own endpoint. Similar to the deployment of GTM containers or <em>gtag.js / analytics.js</em> by Google’s own clients, the elbwalker client loads the desired version and stores in the server’s cache. An arbitrary name can be defined, under which the script can be requested from the server.</p><p>By default, the client “listens” to the path <strong><em>/elbwalker</em></strong>. If events are sent to a different path (which can be defined in the configuration tag settings or HTML initialization), the client can be configured accordingly. Path and name of the script as well as “receiving channel” for the client can thus completely be user defined.</p><h4>Sessions And Users</h4><p>Most tags need ids in one way or another. Depending on how data is sent, id information can be provided either by variables, data from the walker.js event (attributes of the user object are used by default) or as cookie values. the session number field is actually only relevant for GA4. If you don’t change any default settings, the configuration will match exactly data from the example client-side setup in Part 1.</p><h4>Processing Events</h4><p>Whenever walker.js events are received, the client makes all received data available in the ssGTM event model. As far as possible, all “default parameters” are named in the same way as you would get them from a Google client and as expected from most tags on the other side. Especially the event name is usually not “GA4 compliant”. While events from the above examples always contain a matching “<em>event_name</em>” via “<em>globals</em>”, an adjustment of event names otherwise composed of entity and action can be defined here if required.</p><p>Further processing settings can be found in the “<strong><em>Advanced Settings</em></strong>”:</p><ul><li>The default path <em>/elbwalker</em> for the client can optionally be changed.</li><li>To ensure that the information sent in “<em>consent</em>”, “<em>data</em>”, “<em>context</em>” and especially the “<em>globals</em>” ends up in the event model, the options (active by default) are used to merge all key/value pairs. If GA4 should use e.g. the “<em>session_number</em>”, which is placed inside the “<em>globals</em>”, this is the easiest way to pass it to your GA4 tags. Alternatively, the data could be “manually” read from the walker.js event. It gets stored in its own key called “<em>x-elb-event</em>” and can be accessed e.g. with an “<a href="https://tagmanager.google.com/gallery/#/owners/mbaersch/templates/extract-json">Extract From JSON</a>” variable.</li><li>A table serves to add parameters or overwrite certain values in order to transform incoming data to match your indidual needs.</li></ul><p>In general, it is recommended to leave the option to receive the incoming walker.js event enabled in the event model if more recipients than just GA4 are planned. This way, data that can otherwise not find its own spot in ssGTM’s event model can still be accessed when populating tags. Such as the tag for passing walker.js events to BigQuery (see below).</p><h3>GA4 Settings And Conversions</h3><p>The final section consists of a few settings that are only relevant for GA4. Among them:</p><ul><li>The path to the <strong><em>session_start </em></strong>marker generated by the configuration for walker.js in the browser.</li><li>Conversion options for <strong>e-commerce</strong> items, which are recreated from the “<em>nested</em>” object.</li><li>While gtag.js knows which events are <strong>conversions</strong>, we don’t send this information from the browser. Instead this information must now be added at the server so that GA4 tags can process outgoing events accordingly.</li><li>GA4 needs a <strong>session ID and number</strong>. The source fields can be defined from variables or event data.</li><li>An optional debug marker to enable GA4`s <strong>DebugView</strong> (see below).</li></ul><h3>Configure GA4 Tags</h3><p>After it took some effort in both client- and server-side GTM to completely change the way how data gets to your server-side GA4 (or Universal Analytics) tags, the tag setup itself is pleasingly simple, because everything should work exactly as it would with gtag.js as a source.</p><p>Only some additional event parameters are created by the elbwalker client, which you might want to exclude in the configuration of your GA4 tags. They offer a separate section in the configuration to do so. It usually makes sense not to send the following data to GA4 if you can’t do anything with it in the form of a user defined dimension and/or in BigQuery:</p><ul><li>x-elb-event</li><li>x-elb-walker-version</li><li>x-elb-config-version</li></ul><h3>Check Results</h3><p>Checking if everything works as expected can be done in different stages while completing your setup:</p><h4>Events In ssGTM Preview</h4><p>As a first step, the preview in both browser GTM and ssGTM should be checked for proper reception and processing of events. Configuration and event tags should show up firing in GTM and the browser console should include outgoing requests to your tagging server.</p><p>ssGTM preview shows requests coming in and — hopefully — events being created by the client. If the tagging server is used to deliver the script, you will see a request in the summary as well as incoming tracking requests. If tags like GA4, Meta Conversions API or others are firing, it is possible to check the outgoing requests and vendor responses, too. And most importantly: event parameters received and processed should match the settings of your elbwalker client, including the <strong><em>x-elb-event</em></strong> key (if configured).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*Jj4JQ_sHwhFKkGsuIurDDw.png" /><figcaption>walker.js event at ssGTM in preview</figcaption></figure><h3>Events In GA4 DebugView</h3><p>If you want to check directly in the GA4 DebugView whether data arrives in the desired form and with complete parameters, you can activate the setting for the debug flag in the elbwalker client. In this case you will see directly in GA4’s DebugView what has been forwarded to GA4 via ssGTM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*nmSHGD4eJ-CODb3ZyXy4KQ.png" /><figcaption>GA4’s DebugView</figcaption></figure><p>This may well be irrelevant data, which can then be withheld by configuring the GA4 tag on the server to exclude sertain parameters (see above).</p><h3>Results In Reports</h3><p>Also in realtime reports everything should be found, what one might expect there.</p><p><strong><em>Note</em></strong>: The templates on Github do not cover <em>all </em>dimensions that gtag.js collects in the browser. There are <strong>exceptions like browser dimensions</strong>. If there is consent, you can individually add those during initialization to the “<em>globals</em>” without messing with ePrivacy. Other “little things” may be missing that are not needed in 99% of cases, but may be relevant in your specific use case. Therefore it is a good idea to test the new structure sufficiently before abandoning the previous tagging with gtag.js. If both methods run in parallel for some time, comparing results without time pressure is the best way to go.</p><h3>Additional Use Of The Data Stream</h3><p>Rarely, only GA4 is served with data via ssGTM. By making the data structure in the event model as similar as possible to Google Analytics events, other services like Meta Conversion API, Piwik PRO, Matomo or others should be able to work with the data without any additional effort. Also for others like <a href="https://github.com/mbaersch/plausible-analytics-tag-server">Plausibe</a>, <a href="https://github.com/mbaersch/umami-tag-server">Umami </a>or <a href="https://github.com/mbaersch/pirsch-tag-server">Pirsch Analytics</a>, suitable tags can be operated on the server if desired. Or: pass data directly to a database. Like BigQuery.</p><h3>ssGTM BigQuery Tag Template</h3><p>For many, GA4 is mainly a way to get data into BigQuery. Depending on what you want to do with your data, you can save the detour and write all events directly into a BQ table. For this purpose, in addition to some already existing BigQuery tags in the Community Gallery, the new “walker.js To BigQuery” tag template from <a href="https://github.com/elbwalker/sgtm-tag-bigquery">another elbwalker Github repository</a> can be used.</p><p>With the JSON schema found there, a suitable table can be created and supplied with data via the new tag template directly from ssGTM. To use it, proceed as follows:</p><ol><li>Install the <strong>template</strong> as usual as a new tag template in ssGTM</li><li><strong>Add a new tag </strong>and enter your project ID in case of a different project, a database ID and a table name</li><li>Incoming walker.js events are read from the event model when operating in “<em>Automatic</em>” mode. In the client, populating the “<em>x-elb-event</em>” parameter must be activated for this to work. Otherwise, a variable can be used as an input value. Use this option for events from another source that have to be converted into a walker.js event first, or if <strong>enrichment or customization </strong>of walker.js events is desired before saving them.</li><li>Optionally, further <strong>data can be added</strong>, which is stored in either a <em>REPEATED RECORD</em> or as <em>JSON</em>, depending on the structure of the target table.</li></ol><p>All events are then written by the tag to the table, which provides custom <em>JSON </em>fields for <em>globals, data, context, consent</em>, and <em>nested </em>data. An example query showing different methods to access the data:</p><pre>SELECT<br>  timestamp AS event_timestamp,<br>  &quot;page_view&quot; AS event_name,<br>  JSON_VALUE(data.domain) AS page_hostname,<br>  JSON_VALUE(data[&quot;title&quot;]) AS page_title,<br>  /* optionally use JSON_EXTRACT instead of dot notation */<br>  JSON_VALUE(JSON_EXTRACT(data, &quot;$.id&quot;)) AS page_path,<br>  user.device AS client_id,<br>  user.session AS ga_session_id,<br>  <br>FROM<br>  `your-project.your-database.your-walker_events-table`<br><br>WHERE<br>  event = &quot;page view&quot;<br><br>LIMIT<br>  100</pre><p>The result in BigQuery will look something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nWUIKkJ1VVkntn2KRsniRw.png" /><figcaption>walker.js events in BigQuery</figcaption></figure><p>This way you can create a complete database of all events, depending on your setup… as long as you protect yourself from bots ;), This method works independently from GA4 and contains more or less dimensions, depending on your setup and / or consent given in the browser.</p><h3>Alternatives To The Alternative?</h3><p>walker.js is certainly not the only way to send data to ssGTM. When it comes to providing data suitable for GA4 (being very specific in its requirements), many existing solutions are problematic for GA4 because they lack essential information about the session. One in particular stands out: the session start. If we fail to send “<em>session_start</em>” and “<em>first_visit</em>” markers that are essential to GA4, data will lack attribution in almost every report. This is exactly why so much work has been invested in walker.js to extend and support a truly independent format as a full alternative to gtag.js.</p><p>Others have also dedicated themselves to this task and both on my personal blog, Youtube channel and on Github you can find several traces of “my own” data capturing used on my website. The format is very tailored to my personal needs and focused on best performance together with my custom endpoint.</p><p>With walker.js it’s different, because this solution existed before ssGTM and it will evolve without my personal input. Therefore, I recommend anyone who wants to get rid of with gtag.js to avoid developing and maintaining their own solutions if possible — I’ve paid for my decision with plenty of time on maintenance. Who wants that?😉</p><p>If you are looking to replace gtag.js with something different than walker.js, the lightweight gtag alternative <a href="https://ga4mp.dev/">GA4MP by David Vallejo</a> is probably the best choice. This library also takes care of the things that need to be done in the browser like managing session starts. Also available as an open source solution, a certain level of consistency and especially further development can be expected. However, the format in which data is sent is different here, because is uses parameters identical with gtag.js. So you can either send data directly from your browser to GA4 or “in GA4 format” to your own endpoint, where a standard GA4 client can understand and process the requests (because they look like sent by gtag.js).</p><p>This method bears advantages and disadvantages, both of which lie in this matching parameter set: ssGTM needs no special settings when using GA4MP, because everything looks and works “as usual”. On the other hand, there is a higher probability that browsers (now or in the future) block requests due to parameter patterns. With different options for using POST or GET and optionally coded payloads, this probability is potentially lower when using the walker.js format.</p><h3>What´s Next?</h3><p>The real advantage of using this solution is not just the fact that you are independent of gtag.js in the browser and thus have a <strong>reliable and privacy-friendly</strong> incoming data stream for your tagging server, but mainly all the possibilities that walker.js offers for tagging. As a directly implemented solution connected to a Consent Management <strong>without race conditions</strong> in combination with different destinations, you can actually completely do without a Tag Manager in the browser at all. At least if your tagging requirements are either not too complex… or you decide to utilize <em>data-elb</em>-attributes in a relaunch to <strong>minimize tagging effort</strong>. Even if this might sound like an ad: I do not have anything to do with elbwalker beyond my voluntary open source attributions. I am just convinced that ssGTM needs a better request source than gtag.js.</p><p>With version 1.6.0 walker.js has undergone a rather extensive update. However, the journey will not end there. A library with a lot of control that evolves without you having to contribute is certainly an advantage. And with the direction gtag.js is heading as a “<em>one-script-to-rule-them-all</em>” with little control over data collection, this argument may become increasingly relevant. Especially in times when data protection seems to be rewriting the rules on a daily basis.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2b9fd291d919" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build a GA4 Rollup Property Using Serverside Google Tag Manager]]></title>
            <link>https://mbaersch.medium.com/ga4-rollup-property-with-serverside-gtm-df4d4dd26ee1?source=rss-ca8558a31676------2</link>
            <guid isPermaLink="false">https://medium.com/p/df4d4dd26ee1</guid>
            <category><![CDATA[analytics]]></category>
            <category><![CDATA[measure]]></category>
            <category><![CDATA[serverside-gtm]]></category>
            <category><![CDATA[ga4]]></category>
            <dc:creator><![CDATA[Markus Baersch]]></dc:creator>
            <pubDate>Thu, 04 Aug 2022 17:20:20 GMT</pubDate>
            <atom:updated>2022-08-04T17:27:24.586Z</atom:updated>
            <content:encoded><![CDATA[<h3>Build a GA4 Roll-up Property Using Server-side Google Tag Manager</h3><p>Since there are no data views in GA4 and an incoming data stream does not flow into multiple GA4 properties, the question of correct tagging arises for many websites. If e.g. several languages or countries, different parts on individual subdomains or in folders were previously viewed separately in Universal Analytics views, but had a common property: How should this be mapped in GA4? This article documents the results of an investigation for a larger, multi-part website. The question is whether and how it is possible to <strong>combine data from different individual properties</strong> in a common property via a serverside GTM for GA4.</p><h3>One or multiple properties?</h3><p><strong>One property </strong>for all means a lot of filter work in GA4 reports or different reporting UIs via library / menu customization for different parts and tasks. This does not solve the problem that several time zones are then lumped together on international websites, but that does not count as a counter argument here, because it would have been the case in UA. If you have already operated a parallel UA property there, this would theoretically also be possible with GA4.</p><p><strong>Multiple properties </strong>allow individual settings, access control, time zones, etc. That’s great, but without tagging another property in the browser at the same time, you won’t get a view in which all the data can be found. Using the example of a website that consists of <strong>several subdomains</strong>, which are all to be measured in their own individual property, but are also to serve a “roll-up” / collective property, the whole thing looks something like this in simplified form for <strong>Universal Analytics</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Yv5hQQlksEh7DPfZ" /><figcaption>Client-only dual tagging option for Universal Analytics</figcaption></figure><p>This setup could just as easily serve a website with multiple folders for different purposes, audiences, or languages. No matter why there are always several properties or if dual tagging is used or a customTask to duplicate everything: All data that also accumulates in the individual properties for the parts of the website end up in the collective property as a “roll-up”, which is supplied in parallel directly from the browser.</p><p>Data blending in Google Data Studio, evaluations based on Big Query data or switching to GA360 (where there are sub properties and roll-up properties) are the only way out if you want to avoid double tagging in the browser. With one exception:</p><p><strong>Options when using your own endpoint</strong></p><p>If a <strong>serverside GTM </strong>is used as the tracking endpoint (or a comparable “proxy” between browser and tracking service), the rules of the game are different. With Universal Analytics it was / is absolutely possible to forward hits for different properties to the respective recipient (the “UA single property”) as well as to send all hits of all parts of the website / domain to another collective / roll-up property. Sessions managed on the receiver side provided a useful and consistent overall view — as long as you could then come to terms with the limits and sampling etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4NgIr2AuoD-aFTHw" /><figcaption>Stream Consolidation for Universal Analytics</figcaption></figure><p>As long as the recipient — in this case Universal Analytics — takes care of managing sessions for individual visitors, their status, number of visits, determination of goals achieved, etc., this works fine.</p><p><strong>Key question: Is all that possible with GA4?</strong></p><p>With GA4, however, the cards are reshuffled again and the above setup fails due to the fact that <strong>sessions are managed in the browser </strong>and so each property has a different status. The client ID is shared, but the session ID and numbering of the session are under the control of the browser and are different for each property. The same applies to the information as to whether a session is starting or whether a user is new or not. Can the above construct also work for GA4, although control of the session and the other above attributes for visits and visitors live in the browser — i.e. the sender — and not the recipient of the hits?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oPtaCbF1YwVIJcZme_Nrkg.png" /><figcaption>Stream consolidation for GA4 with ssGTM: Possible?</figcaption></figure><p>I tried different options to find out exactly that.</p><p><strong>Restrictions for “simple” duplication of GA4 datastreams at the endpoint</strong></p><p>Combining several GA4 data streams into a new (valid) stream at the ssGTM endpoint is not trivial for the reasons mentioned above.</p><p>The following aspects pose as problems:</p><ul><li><strong>Session ID</strong>: It changes with the property when navigating from one part of the website to another. For example, if you switch between blog and shop with separate properties for measurement.</li><li><strong>Session number</strong>: The number is also not consistent if you throw all GA4 hits into one pool. The above switching from blog to shop creates a new session from the point of view of the shop property with an (usually) different number, because one usually does not always visit all parts of a website</li><li><strong><em>Session Start and First Visit marker: </em></strong>Whenever a session arises, a marker is sent with the hit (_ss=1) which causes a <em>session_start</em> event to arise in GA4. Also (if the session number is 1 there is a marker for the first visit (_fv=1) which results in a <em>first_visit</em> event and ensures that there is something like a “<em>First User Source</em>” etc. in GA4</li></ul><p>As a result, in such a “collective property” with all unfiltered hits from different GA4 data streams without further adjustments, a lot of sessions, “new” visitors and the associated events that are actually (from the point of view of an overall property) superfluous.</p><p><strong>GA4 example: returning visitor</strong></p><p>This is what it looks like using the example of a returning visitor who has been to the www property several times and once to the shop.</p><ul><li>If the renewed visit to the www property begins, a session and a start arise. The session ID is unique and the visit number is 3 because there have been previous visits to the property. Further events can now follow within the property</li><li>One click leads to the blog (where no visit has taken place so far). A new session is created there from the perspective of the blog property and a <em>session_start</em> and <em>first_visit </em>are reported — also to the roll-up property. From their point of view, the session ID and number have also changed</li><li>The same thing happens when you switch to the shop, but there is no <em>first_visit</em> because there was already a visit there from a previous session</li><li>From the shop back to www, the session ID and number now changes again from the point of view of the roll-up property. Since a www session already exists, there are no new <em>session_start</em> events</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*itJGh3M3o8brfPE6" /><figcaption>How a roll-up property “sees” consolidted streams</figcaption></figure><p>In this way, inconsistent session information arrives in the ro-llup property and, in addition, unwanted events may occur when changing. So while the number of page views should match or transactions should end up correctly in the roll-up, a <strong>“cross-domain” attribution</strong> of conversions to visits and their source are usually <strong>disturbed</strong>.</p><p><strong>Solutions for GA4</strong></p><p>I’ve tried a few things and tinkering to make the overall view as meaningful as possible. The above inconsistencies in the session information and unnecessary restarts are problems that can be dealt with in different ways using the standard tools of the client- and server-side Google Tag Manager.</p><ol><li>Sending all hits using a standard tag for GA4 with overridden measurement id to consolidate all hits in one roll-up property. Suitable for mainly separate hosts or domains</li><li>Like 1), but with special handling of changes between the properties and new sessions that arise as a result. For useful results, a separate, comprehensive session should also be managed. This can optionally be controlled in a client-side GTM or from server-side</li><li>Using the GA4 Measurement Protocol</li><li>A separate client in ssGTM that sends all hits to the roll-up property (adjusted for further session starts and its own session control as with option 2) and then passes it on to the normal tags</li><li>Duplication of hits in the client by monkey patching the send function in the browser. This option is not dealt with here and the result is comparable to option 1. It is only mentioned here for the sake of completeness.</li></ol><p>Expect different results when implementing options 1 through 4. Not every setup has to pull the “preferred” option 2. The following sections describe the implementation and the resulting data in a roll-up property.</p><h3>Option 1: Standard GA4 tag to consolidate all hits into one property</h3><p>A simple tag that fires on all GA4 hits regardless of the Measurement ID and overwrites it with the new ID of the collection property can only be used with the above restrictions. Even overriding individual fields is of no help here if it is the specific field in question. Because the information about the session start or first visit when changing data streams sits in “System Properties” under the key <em>x-ga-system_properties</em> in the event model, and overwriting doesn’t seem to change anything in the outgoing hit. I tried it first by removing the parameters from the original content of the information stored as an object in a variable using a custom template. However, this does not work, because an _ss=1 and eventually _fv=1 is still sent out when you look at the outgoing hits. Removing the information by overwriting it with an “Undefined Value” variable has the same effect; ditto the editing functions for parameters that the tag brings with it. This method is therefore not very suitable because it can lead to an <strong>overflow of sessions</strong>.</p><p>So is this option <em>generally</em> unsuitable? I do not think so. In cases where e.g. different countries or otherwise separate target groups are reached on separate domains, which are to be measured in individual properties, this option is quite <strong>useful with some limitations</strong>. As long as the number of “property changers” (both within a session and in general) is kept within limits, the results match quite well what one would get from the sum of the individual properties.</p><p>Another advantage of this solution is that it <strong>can be used in a “multi-domain setup”</strong>, in which not only several hosts but completely different domains are measured. However, consolidating at your own endpoint does not solve any cross-domain problems. If this is not mapped in the client by true cross domain tracking, each domain will have its own cookies and there will be no overall ID. As I said: This doesn’t have to be tragic — depending on the reason why there are several domains.</p><p><strong>Option 2 — Step A: Standard GA4 tag with special handling on property change</strong></p><p>In order to somehow avoid the occurrence of further <em>session_start </em>and possibly <em>first_visit </em>events, a different approach can be followed.</p><p>In order for all hits to arrive consistently in GA4, the session ID and session number must be retained. It is also about preventing the creation of new sessions in GA4 and the attribution of conversions over an unbroken overall session in a “multi-stream roll-up property”. For this purpose, a special treatment must take place every time a new session (from the point of view of the individual properties with whose measurement IDs the respective site is tagged) arises when the domain changes. For this purpose, an independent session ID and number is generated and used throughout all events. When switching between the individual parts, certain events are skipped. Based on the example above, the different handling for the roll-up property looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OnlCjSCXIecnbg0C" /><figcaption>Independent roll-up session for consistent session data</figcaption></figure><p>In this way, both the individual properties and the roll-up variant would get exactly what is needed. Sounds good? Then let’s start with the second problem:</p><p><strong>Detect property changes</strong></p><p>In order to recognize whether a session already exists or not, a marker like a session cookie can be used to see whether the first entry has already been measured, including the session start and, if applicable, the first visit. Which means that another start (from another property) has taken place. In the very simplest case, you only prevent this hit with a blocking trigger (recognizable from the above-mentioned system properties and a separate cookie) and skip the whole event.However, we solve it differently in this example and close the gap.</p><p>If you create a session cookie with any value, you can use it in a trigger to determine whether a session start has already been measured or not. To do this, you need a tag that fires whenever there is no marker cookie yet, but a GA4 request with <em>session start</em> features comes in. You can use e.g. the “<a href="https://tagmanager.google.com/gallery/#/owners/gtm-templates-simo-ahava/templates/cookie-monster">Cookie Monster Tag Template</a>” by Simo Ahava. A timestamp as a value works just as well here as any constant, a “1”, the client ID from the GA4 cookie or whatever.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/0*2IKRYYsz0-72b1dc" /><figcaption>Set your own “session start already measured” marker with a cookie</figcaption></figure><p>If you access this cookie value in a standard cookie variable, it can then be used a) for the firing trigger of the Cookie Monster tag (fire if there is no value) and b) the blocking trigger for the GA4 collective property tag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/890/0*G4SReN33Fs1mcF2H" /><figcaption>Blocking trigger for session_start events when property changes</figcaption></figure><p>Here, the marker for the session start in incoming events (see last condition) is accessed by reading the “System Properties” (see above) as event parameters via a standard variable and serving as an input value for an extraction variable that gets the value for “ss” extracted from the JSON object.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/420/0*xOONMlvA3_G7jrI2" /><figcaption>Reading the session start marker from incoming events</figcaption></figure><p>If you stop at this point with the special treatment, you will actually already see fewer sessions in the roll-up property, so you could already book this as a partial success. But it’s ugly because <strong>events are missing that way</strong> (whenever the domain is changed). Also, if you need your own cookies anyway, you can go all the way and gain complete control over the roll-up session.</p><p><strong>Option 2 — Step B: Session control with own cookies</strong></p><p>In order not to send the possibly inconsistent session IDs and numbers to the roll-up property when visitors switch between the individual properties, an independent session for the roll-up property must be established. This can be managed in a number of ways; e.g. in a common cookie or in separate cookies — managed server side or in the client. In case of the client, there are alternatives such as <em>localStorage</em>. On the server you could work with fingerprints and persistence in Firestore… let´s just say, there are choices.</p><p>Since cookies (and consent) are required for GA4 anyway, separate cookies set on the client side are sufficient. Managing the roll-up session in the client has the advantage that all hits already bring them with them in the request when they arrive at the endpoint. If it is created there, this not only means some effort in the form of variables and triggers, but you are also confronted with batching problems (see below: <em>“Alternative: create a session in ssGTM”</em>). I tried it anyway and was satisfied with the result, but the client-side session is evenly suitable for the roll-up property. And individual properties also work with browser-generated cookies — so why bother?</p><p><strong>Session helper tag for GA4 in browser</strong></p><p>The recipe for the roll-up session is relatively straightforward: All containers of the individual properties involved (if there are several) require an HTML tag that takes care of the cookies via JavaScript.</p><p>It is first determined whether there is already a cookie for the session ID. If not, it is created, the cookie value is read out with the session number (if it exists), the session number is incremented and saved again in a cookie. Here is the code for a corresponding solution that does not require an additional cookie variable for the session number, but instead reads the cookie value directly in the code for the sake of simplicity (just ignore the German comments ;)):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/0*Djz9PlejNNcaZroD" /><figcaption>Quick but working roll-up session handling in client-side GTM</figcaption></figure><p>So there are two cookies involved: a session ID in a session cookie and a session number in a persistent cookie. As mentioned above, this is not the only solution, but it works and makes using the ssGTM endpoint easier. This saves you the trouble of separating the ID and number in a single (then persistent) cookie and manually renewing “too old” sessions.</p><p>The HTML tag is used as a setup tag of the GA4 configuration tag, so that before any hits get sent, it has a fair chance of recognizing and initializing a roll-up session that may not yet exist. The cookie values ​​then travel to the tracking endpoint along with the hits.</p><p><strong>Alternative: create a session in ssGTM</strong></p><p>If you want to save yourself the work to put the above tag in all containers for individual properties: Using a helper tag can take care of the whole thing with a little extra work on the server. Since in this case the session number and ID must first be determined on the server side at the time the first hit arrives, used at the event and then sent in the response (via Cookie Monster), several variables based on (existing) custom templates such as “<a href="https://tagmanager.google.com/gallery/#/owners/mbaersch/templates/number-string-operations"><em>Number &amp; String Operations</em></a>” and “<a href="https://tagmanager.google.com/gallery/#/owners/mbaersch/templates/timestamp"><em>Timestamp</em></a>” are required, with which a “<em>Next Session Number</em>” and “<em>New Session ID</em>” are generated for the start of a new roll-up session, that fires an special tag, which is only used for the “first hit”. All subsequent hits then use the ID and number from the cookies previously set on the server in another tag.</p><p>In addition to the advantage that no adjustments are required in the client in this case, it is also possible to work completely with “server-hardened” cookies (or even <em>httpOnly</em>). There is some risk of a “chicken and egg” situation (which I haven’t seen in testing) from <strong>batching</strong>. So, in theory, this is the more robust option… while at least one ITP vulnerability can also be mitigated by simply renewing the client-originated session number cookie.</p><p><strong>Setup on tracking server</strong></p><p>In ssGTM, incoming session information is received in cookie variables. For example the session number.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/386/0*6RtyOoj-7Q-aWaoQ" /><figcaption>Access roll-up session data in ssGTM</figcaption></figure><p>Then also create a cookie variable for the session ID. Both are then used to override session ID and number <em>(ga_session_number and ga_session_id</em>) in a GA4 tag that fires on all requests arriving in GA4 format:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/0*4h0hQ3-ydrGefMJs" /><figcaption>Override session data in “roll-up” GA4 tag</figcaption></figure><p>If this tag is blocked for all domain changes (see above), the state of option 2, step A is reached — but with coherent session ID and numbering.</p><p><strong>Closing the gap in the property change</strong></p><p>What remains is the problem of missing events when changing the property / domain. A normal GA4 tag is no solution because (as tested in option 1) it is not possible to overwrite system properties. Instead (among some other things that require custom code in custom tag templates) you can simply use the Measurement Protocol.</p><p>To do this, just send the event via measurement protocol as part of the existing session when changing properties, so that there are no <em>session start</em> or <em>first_visit</em> markers (in this case, they cannot even be included). Using the same session ID (the number can be omitted, although it can be sent as <em>session_number</em>), the hit ends up in the context of the web session, which is composed of the individual sessions of the sub-properties by the common session ID. Such events are more or less equivalent to a “normal” hit that in most cases should be a page view… but it doesn’t have to be. In my tests, I actually found all other events that may have been sent before the <em>page_view</em> occurred (a list can be found at the end of this article).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/0*6dJPDMso5rNArooN" /><figcaption>Filling the gaps with GA4 Measurement Protocol</figcaption></figure><p><strong>Important note: </strong>The design of the event shown here only includes the absolute minimum state (apart from the “<em>serverside_route</em>” which I only added for debugging purposes in this experiment). In order to cover all parameters — and e.g. also pass on user properties — either a custom tag template is required that covers all required fields (<a href="https://github.com/mbaersch/ga4mp-tag-server">that</a>’s how I solved it) or the above example has to be supplemented with all relevant event parameters. Since there can also be e-commerce events, incomplete parameters would not be able to fulfill their actual purpose in terms of reporting. For example: With the above minimal setup I saw gaps in conversions and differences in total engagement time due to missing parameters until I forwarded all necessary information by GA4MP as well.</p><p>The tag is triggered when a property change occurs. The same trigger is defined as an exception for the “normal” roll-up GA4 tag, so that it is blocked on these events.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/507/0*DDvforyrZ4RZP36E" /><figcaption>Trigger for firing GA4MP tag (and blocking regular roll-up tag)</figcaption></figure><p>In this way you have created the best possible approximation of a roll-up property for the individual parts of the website. Depending on the reason for which different properties exist, property changes within a session may be so irrelevant that you can simply save yourself the effort of filling them up using the measurement protocol. Tagging all events in a custom property enables filtering of all events created by this tag in GA4 (mostly they should be <em>page_view </em>events).</p><p><strong>Option 3: Measurement Protocol “All In”</strong></p><p>A completely different approach would be the continuous and sole use of an HTTP request tag to send the hits via measurement protocol. If the — reduced — data of all incoming hits of the individual properties are simply passed on to GA4, some problems have been eliminated. Since a session ID (generated on the server side and stored in a cookie by Cookie Monster) can be easily generated and used as a common bracket around all hits, the Measurement Protocol is theoretically even the best choice. A session number is not required to achieve the measurement of a common session. I actually tried it, whereby I then limited myself to the events that are essential and thus e.g. For example, engagement is sacrificed because it has to be specified in GA4MP on the hit itself. Sure, you can tinker and get engagement timings from A to B, but it wasn’t worth the effort for a test, so I went with a constant default value:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/0*O7kPeYVE6vH5L8j1" /><figcaption>(Too) simple Measurement Protocol hit with HTTP Request tag in ssGTM</figcaption></figure><p>The resulting reports are not completely unusable… but as I have already described in my <a href="https://www.markus-baersch.de/blog/google-analytics-4-measurement-protocol-fuer-websites-experiment/">post on GA4 website measurement via Measurement Protocol</a> (German), many bells and whistles are missing. It may be that this route is more suitable in the future if Google decides to do more with the data that comes from GA4MP. As of now, attribution can only be done manually and in Big Query or though raw data processing. Nevertheless: If you don’t have an incoming GA4 data stream at all, but still want to create a “roll-up property” in GA4 from various incoming requests for different purposes, you can definitely go this route.</p><p><strong>Option 4: Own client</strong></p><p>If you assume that incoming GA4 requests should only be forwarded to GA4, then you still typically have a client that translates everything into the event model and a tag that reassembles the same request. This makes sense in most setups, because there is more than one tag waiting for an event on the other side. At least in an experiment, it would be conceivable that you could save all of that completely. In this case, whenever a GA4 request arrives, a separate client would react to it.</p><p>It can forward the incoming request including all other events sent as a batch in one go to the GA4 roll-up property (forwarding requests to google-analytics.com including — almost — all parameters and POST payload) and then process it normally and make the events available to tags. The client’s overhead then consists of managing the measurement state of the session start using a separate cookie and reacting accordingly whenever a _ss marker is present in the request. The result should actually be the same in GA4 if you also include a few headers and thus pass on the (shortened) IP and user agent in a controlled manner.</p><p>The goal would be to save all the overhead of event processing in client and tag. This <em>should </em>result in less load at the endpoint, which is ideally reflected in the required instances and/or costs. Especially since you don’t have multiple calls for batches, but can process everything in one request and batch it out. If anyone is interested in this experiment — talk to me! 😉</p><p><strong>Note</strong>: If you are tempted to simply use a kind of “Request Repeater” as tag in ssGTM as a variant of the above idea to pass on all incoming parameters of the requests to GA4, you will quickly run into a problem: Page views or other events are either higher or lower than the sum of the partial properties. This is due to batching, where an incoming request can contain multiple events. When forwarding in a tag instead of a client, the events that may be contained in the request body are either missing or processed several times, depending on the setup. Since conversions would also be affected, it’s not really a solution (I actually tried it 😐).</p><p><strong>Results</strong></p><p>I checked all the tests using a GDS report, in which I combined selected metrics from the four individual properties involved in the test via data blending and compared them with the data from the roll-up property. Since up to five data sources can be merged, differences between totals and roll-up can also be displayed directly. I used the main website, a blog, a B2B and a B2C shop in my test.</p><p>The following figure shows (almost) the expected result when using option 2B (regardless of whether the roll-up session is managed on the client or server side):</p><ul><li><strong>Users </strong>and <strong>sessions </strong>should be lower, as there is a high probability of switching between the individual parts</li><li><strong>Pageviews </strong>should match</li><li><strong>Revenue </strong>and <strong>transactions </strong>should also be the same</li><li>Total <strong>conversions </strong>should correspond to the roll-up value</li><li><strong>Event </strong>count should be lower because <em>First Visit </em>and <em>Session Start </em>events are missing</li><li>The distribution of users to <strong>individual source / medium</strong> combination is independent of the individual properties (not shown in the picture)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XP3YJxcI1RhuYeT1" /><figcaption>Results for roll-up property compared to single properies</figcaption></figure><p>There are minor differences in page views (“views”), conversions, and revenue, but overall things seem to be working out very well.</p><p><strong>Where do the differences come from?</strong></p><p>A certain difference in the events is to be expected / welcomed, because there must be a “hole” if the <em>session_start </em>and <em>first_visit</em> from the individual properties no longer appear in the roll-up if a session has already been started there. The control of individual event types via corresponding filters shows a certain pattern: A few <em>view_item</em> and <em>user_engagement</em> events are missing, so that the measurement of the engagement time is also somewhat wrong. The following view shows that of the 9,681 difference in events, a whopping 9,509 are due to expected session starts and newly recognized users — and engagement events.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*u_0VPV0PDn-_xxEd" /><figcaption>Event breakdown for “missing” events</figcaption></figure><p>The explanation lies (at least I think so) where events arise where there is still an existing GA4 session of the single property, but the roll-up session of the browser no longer exists. This happens e.g. after closing the browser, which ends the life of the session cookie used for this purpose. If events are then sent as part of a batch (=several GA4 events in one request), such gaps sometimes may arise. The reverse case can also have this effect. Therefore there are — very small — differences. But is that tragic? Certainly not. If you want to close the event gap further, you can find solutions in the administration of the roll-up session; e.g. using a shared cookie with a lifetime independent of the session; possibly hardened by the server or generated directly there (see above).</p><p>The difference in transaction amount remains. I can’t really explain the “around 50 cents per day”, but there was always a certain deviation in the cent range over the test period, in which the number of participants in the form of individual properties was limited to allow for a clear test setup with simple evaluation in Google Data Studio — and of course afterwards as well. It seems pointless to invest more time for further research here.</p><p>As you can see, the differences are marginal or explainable and to get over. The roll-up property does its job: A cross-single-session measurement that traces conversions and revenue back to their source, regardless of the “site section” they occur in or where the visitor might have entered.</p><p><strong>Important note: Conversions via Measurement Protocol</strong></p><p>Since not only page views, but also other events can be affected when a property change takes place and special treatment is necessary, all possible conversions must be marked or entered in the roll-up property in the configuration area. Because while the information that an event is a conversion arrives correctly in the GA4 roll-up property when using the standard GA4 tag, this is <strong>not the case with the measurement protocol</strong>. In order for such events sent via GA4MP to be correctly recognized as a conversion in the roll-up property, the conversion configuration must also be repeated there. Yes, exactly: I fell for that (like many stumbling blocks that can no longer be seen in this article). Here you can see the various events that were transferred with a different tag and not the normal “GA4 Roll-Up Tag” when the property was changed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/794/0*srfFjXXHQ_NOOYqY" /><figcaption>Not just page views: every event can contain a session start marker</figcaption></figure><p>As you can see, while property switch events are mostly <em>page_view </em>events, anything else can be there too. If there are also conversions such as <em>generate_lead</em>, those will be missing in conversion reports in a roll-up property without the appropriate configuration.</p><p><strong>Restrictions</strong></p><p>With option 2, the results are in my opinion quite usable — both in GA4 itself and in Big Query. There are some limitations to this method that are difficult to address when they occur. Luckily, not all issues are equally relevant to every setup.</p><ul><li>There may be inconsistencies in the configuration of event properties… and — much worse — user properties. Once there is a session scope, it doesn’t get any better.</li><li>Within a session, the status of an “Engaged” session can change back to “Not Engaged” when the property is changed</li><li>result quality of the roll-up property is largely dependent on the setup of the individual properties. All partial properties should ideally be set up in a consistent way and kept in sync</li><li>Missing first visit information such as “<em>First Session Source</em>” occur when legacy issues exist, i.e. client IDs are not new. The first entry measured in this way may not be reported as a first visit from the roll-up perspective. In that case, a marker for the first visit is then simply missing for this new user and the corresponding dimensions are therefore also not assigned.</li><li>The limit is reached with <strong>cross domain tracking</strong> (except for option 1), because your own session cannot be transported between the domains (without further work in the client and sacrificing httpOnly … or switching to fingerprints and server-side state).</li></ul><p><strong>Where to start?</strong></p><p>In general, setting up option 2 can be done with a few variables and tags, regardless of the long explanation in this article, if an ssGTM is already in use. And following a similar path, other first-party endpoints can be used to consolidate incoming data streams of different properties as well. Even if setting up an ssGTM is associated with costs and maintenance: Depending on how important parallel data evaluation in GA4 (without parallel tagging in the browser) is, these are negligible compared to the costs of the 360 ​​variant. So you don’t necessarily have to buy the “large version” for this reason <em>alone</em> if the other advantages are irrelevant.</p><p>If your requirements are simple or you have separate target groups, option 1 might be the best choice (at least to start with). It only requires one additional tag on the server — done. “All-In Measurement Protocol”, on the other hand, only makes sense in exceptional cases. For example, if the incoming data stream is not in GA4 format and only limited event properties are available anyway, the GA4MP may be an option. Building your own client remais untested, but could be profitable with larger amounts of data and theoretically has the best coverage in the roll-up property with minimal computing effort on the server.</p><p>In case of doubt which option fits your own requirements best, test yourself using several options or variants (server-side vs. client-side session management, for example). At least that’s how I found my preferred solution. If you want to give it a try: best of luck!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=df4d4dd26ee1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Attribution Problems in SPAs: Solutions and Caveats]]></title>
            <link>https://mbaersch.medium.com/attribution-problems-in-spas-solutions-and-caveats-9362fbe8ac3a?source=rss-ca8558a31676------2</link>
            <guid isPermaLink="false">https://medium.com/p/9362fbe8ac3a</guid>
            <category><![CDATA[measure]]></category>
            <category><![CDATA[tag-manager]]></category>
            <category><![CDATA[google-analytics]]></category>
            <dc:creator><![CDATA[Markus Baersch]]></dc:creator>
            <pubDate>Sun, 06 Jun 2021 15:40:16 GMT</pubDate>
            <atom:updated>2021-06-07T15:28:06.257Z</atom:updated>
            <content:encoded><![CDATA[<p>Modern websites are often built as a <em>Single Page Application</em> (SPA). This is especially the case in ecommerce. Instead of the old “here is your page, ask for the next one whenever you like” approach, SPAs may still load content from a server in order to react to visitor actions, but this happens in the background and the existing DOM is changed without loading a complete new page source code and start all over again with every change of url / location. Still, most SPAs are navigable by the browser’s <em>back</em> button. For a visitor this technological difference has few to no real effect. But from a client-side tracking perspective, <strong>a clean setup can still be a big challenge</strong>.</p><h3>Background</h3><p>SPAs usually never experience a real page load second after the visitor enters the site. All succeeding events and pageviews are triggered by some kind of dataLayer event, so a tracking setup (like GTM) can use these events as a replacement for the usual multiple <em>Container Loaded</em>, <em>DOM Ready</em> or <em>Page Loaded</em> trigger points.</p><p>One of the main differences between tracking of SPAs vs “regular” websites is the fact that <strong>the referrer information never changes</strong> when internal links do not lead to the classic <em>request/response</em> browser behaviour.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*u4gewxJeMa0eQEP-" /></figure><p>While all following pageviews of a normal website contain the preceding page url as referrer, in SPAs the original referrer remains unchanged.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*isR5z73mNsB4ybwq" /></figure><p>Reloading a page inside SPAs manually does not change that. And <em>document.referrer</em> is a read-only attribute, so a simple reset is impossible. Or — to be precise — you <em>can </em>set a new <em>document.referrer</em> for the existing page with some effort, but that does not solve the problems that arise with a reload.</p><p>This is the reason for one of the most impactful problems, when measuring SPAs with Google Analytics: <strong>attribution</strong>. Hitting the right bucket for a visit or conversion suddenly can be a difficult task. Besides many others like handling user consent, working with Google Optimize, building reliable triggers (or using trigger groups)...</p><h3>Impact on Attribution</h3><p>SPA behaviour can lead to several problems, when it comes to attribution of a visit to the right / desired traffic source. Whenever a <strong>referring site uses identifiers like UTM parameters or click ids</strong> like a Google Ads gclid, the referrer should <strong><em>not </em></strong>define source and medium, but the parameter of the entrance url. Every reloading event in a SPA on a different URL than the one at the visitor’s entrance might lead to a new session that gets attributed to the “surviving” referrer information. Because the original URL identifiers (which defined the source and medium for the original session) are not available anymore, but the referrer is still the same. Simo Ahava dubbed this issue the “<a href="https://www.simoahava.com/gtm-tips/fix-rogue-referral-problem-single-page-sites/">rogue referral problem</a>” a while ago.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QIUNJ7C3i7dAfPYY" /></figure><h3>Typical Solutions</h3><p>Typical “rogue referral” solutions either</p><ol><li>control the page and <strong>location</strong> parameters and / or</li><li>unset (meaning: discard) the <strong>referrer </strong>after the first hit</li></ol><p>In case of a “hard reload”, the still existing referrer would be ignored in the second approach. In order to achieve this, the <em>referrer</em> field of Google Analytics hits is populated by a custom JS variable or a <em>customTask </em>is used to achieve the same goal: Sending the referrer once, persisting the referrer information and discard the <em>dr</em> parameter it in all following outgoing tracking hits as long as the referrer matches the persisted and already sent url.</p><p>The first — and common — approach uses <em>location </em>and <em>page</em> GA configuration fields or a customTask to preserve the original entrance location with all parameters and just change the page information, when the visitor navigates to other URLs inside the SPA. Simo Ahava (who else?) covered this problem and possible solutions on his blog and even provides a <a href="https://www.simoahava.com/analytics/persist-campaign-data-landing-page/">Custom Tag Template</a> for GTM to persist campaign data.</p><p><strong>Persisting referrer or original location data</strong> for a “session” can be achieved in a variety of ways in SPAs. While localStorage, sessionStorage or cookies can be used by both SPAs and regular sites, the “single page” nature allows additional options, because “the page” and its resources usually never go away. So storing something in the dataLayer or any other JavaScript variable will keep it available on succeeding virtual pageviews (changes of <em>page </em>value).</p><h3>Comparison</h3><ul><li>every storage that exclusively relies on the dataLayer or JS variables will fail, whenever a <strong>page reload or loading of a new page</strong> occurs. And as a referrer does not go away in SPAs, a new session in GA with a possibly new source (if the mentioned identifiers in the entrance url were used) is the result. A mix of SPA and Non-SPA parts of a site or several subdomains make this solution even more vulnerable, because additional page loads after landing on the site are simply inevitable in some cases. Adding the mobile context, where reloading a page by the browser after switching apps is common practice.</li><li>Storing data in localStorage or persistent cookies needs some kind of limited lifetime, so that a <em>real </em>new session does not get misattributed</li><li>sessionStorage or session cookies comply with the browser’s session concept. This does not match a session in Universal Analytics or its equivalent in GA4.</li></ul><p>Using something that outlasts a page load solves sole problems, but brings some new challenges. Limited storage lifetime, like 30 minutes to match the standard session duration in GA, has one crucial disadvantage when applied to a referrer in order to determine if the current referrer should be sent or not: the <em>document.referrer</em> information might live longer, if the tab is never closed, but a reload is forced — or the browser restores tabs after being closed. Especially in mobile use-cases this is likely to occur during a session, in particular when a visitor uses Safari.</p><p>Here is what happens, when a referring site (markus-baersch.de) provides a link to a SPA page with UTM parameters and a visitor clicks it, visits the SPA and navigates to a second page on a mobile device using Google Chrome (Dev-Tools via Remote Debugging):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*v4hPmirEyJ6jBP-L" /></figure><p>The console shows the location of the first page, the referrer and — after navigating the site — a different location. The current location does not contain UTM parameters anymore, the referrer stays the same.</p><p>If the tab is not just inactive for a while, but the whole browser is closed (e.g. using the task manager)….</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DAAJDXEvnoZ5lYus" /></figure><p>… and then the browser is restarted and restores the last tab by reloading the page. The initial referrer is unfortunately still present:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eRFHBz3DegekXZZ1" /></figure><p>Everything in the <strong>dataLayer </strong>or JS variables from the first page load <strong>will be gone at this point</strong>. If a solution relies on this kind of storage, the new session starts and gets attributed to the referrer — regardless of time elapsed between the initial entrance and the reloading event. However, there is one exception: if the referring domain is included in the referral exclusion list in GA and the session still lives, following hits can be counted towards the previous session.</p><p><strong>Same goes for sessionStorage</strong> in this case, because the browser was closed and the reloaded tab will not be able to access the referrer (or location) from the browser storage, that was reset due to a new session from a browser perspective. The existing referrer is used and a new session most likely starts with this source information.</p><p>Would the last sent referrer still be known to the application (from <strong>localStorage </strong>or a persistent cookie for example), tracking can skip sending the referrer (or reuse the original entrance location). This may still lead to a new session (if the last one has timed out) but it will be a <em>direct / none</em> session, if the referrer is the weapon used to fight rogue referrals and the reloaded page url differs from the landingpage for the previous session and so the identifiers are missing. With UTMs or a click id present in the url, the attribution will match the first one.</p><p>In case of a persisted original location the new session will be attributed to the source from identifiers in the URL as well… if there <em>were </em>any. If the first session was a real <em>referral </em>visit and only the location was stored, a <em>direct </em>session instead of the desired <em>referral </em>emerges after the reload.</p><h3>Mixed Environments</h3><p>An additional aspect to consider: If your solution is based on browser storage and the site consists of several (Non-)/SPAs on different subdomains like a separate blog, website and shop, linking between the parts will usually lead to a complete reload of the entry page, when changing from one app to another. As localStorage has to obey the <em>Same Origin Policy</em> that allows access to stored items only if hostname, port and protocol stay the same, the referring subdomain will be the <em>document.referrer</em> for the target SPA initial page load on a different subdomain and thus a new (“internal”) referrer is sent and stored once with every change of domains. Add external payment providers in SPA online shops to the game, if this seems too much like a constructed case.</p><p>While this may be not a problem for the existing session thanks to the referral exclusion list in Universal Analytics or the automatic self-referral exclusion in GA4, a new session with the last internal referrer can occur, whenever the old session timed out or the initial referrer (stored in a browser storage key for a different subdomain) is lost. For Example, when a tab is restored like demonstrated above on any other subdomain than the initial one.</p><h3>Store What? Where? For How Long?</h3><p>Storing both location and referrer can solve some of the problems. But how long should those references of the initial visit live?</p><p>The usual 30 minutes of storage lifetime prevent the browser from holding back the referrer in cases, where it might not be appropriate any longer. A second visit from the same source on the following day for example should be attributed correctly and not count as a <em>direct</em> session, just because a legit referrer did not get sent to GA.</p><p>But if the time span between storage and reloading the page is just outside the 30 minute range, the initial <em>document.referrer</em> gets resent and the new location may not contain the original identifiers. Hence a new session originates and is attributed to the referring website instead of the utm source for example.</p><p>As an edge case, <strong>storage could live “forever”</strong> (or at least for the duration of the longest conversion window) and only gets updated if a new referrer (different url or undefined) or identifier occurs. This would lead to a <strong>maximum of “correctly” attributed conversions</strong> and transactions to the last known source, even without the Last Non-Direct Click Attribution in Google Analytics. But if attribution of <strong><em>visits — </em></strong>and not <em>conversions — </em>to the correct source is of some value and a real direct session should be added to the corresponding channel, unlimited lifetime of attribution information <strong>may be counterproductive</strong>.</p><h3>Finding a Sweet Spot</h3><p>Therefore, the “best” solution depends on how important it is to attribute success — or visits — most accurately to the “real” initial source of an interrupted session. 30 minutes may not be enough time for every visitor to reach a goal or make a transaction after “pausing” a visit, even if this span matches the standard session timeout in GA.</p><p>Still localStorage (single SPA / domain) or persistent cookies (for all mixed cases) seem to be the right place to store such information. If possible, <strong>examine your existing data for a balanced attribution</strong> in order to find out how much time typically lies between a <em>google / cpc</em> and a following <em>google / organic</em> session for the same clientId with success in the second session (that should be attributed to the first one instead). With this information, a “most accurate” attribution can be achieved by keeping the second sessions at <em>direct / none</em> (discarding all identifiers and referrer information)… or by reusing the initial referrer and location, so that the second session will originate from the same source than the preceding one. However, a <strong>perfect solution</strong> that exactly matches multi page site tracking behaviour in <em>all </em>cases <strong>seems impossible</strong>.</p><p>That makes consideration of these aspects even more important, when choosing and implementing a solution. All of them might have some side-effects that were never taken into account. Looking for breaking sessions that switch from <em>Paid </em>to <em>Organic </em>or from UTM tagged campaigns to <em>Referral </em>might still be a good idea, even if some kind of solution is already in place.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9362fbe8ac3a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>