6 reasons Facebook ads don’t match the data you see in Google Analytics

If you run Facebook Ads and want to see how they perform in Google Analytics, you may have noticed some big discrepancies between the data available in Facebook Ad Manager and GA. Both systems use different ways to track clicks and visitors, so let’s unpick where the differences are. There are two kinds of metrics you’ll be interested in: ‘website clicks’ = the number of Facebook users who clicked on an advert on your own site, and (if you do ecommerce) the transaction value which was attributed to that advert. Website Clicks vs Sessions from Facebook 1. GA isn’t picking up Facebook as the referrer If users click on a link in Facebook’s mobile app and your website opens in an in-app browser, the browser may not log that ‘facebook.com’ was the referrer. You can override this (and any other link) by setting the medium, source, campaign and content attributes in the link directly. e.g. www.mysite.com?utm_medium=social&utm_source=facebook.com&utm_campaign=ad Pro Tip: you can use GA’s URL builder to set the UTM tags on every Facebook campaign link for GA. In GA, under the Admin tag and then ‘Property settings’ you should also tick the box saying ‘Allow manual tagging (UTM values) to override auto-tagging (GCLID values)’ to make this work more reliably. 2. The user leaves the page before the GA tag fires There’s a time delay between a user clicking on the advert in Facebook and being directed to your site. On a mobile, this delay may be several seconds long, and during the delay, the user will think about going back to safety (Facebook’s app) or just closing the app entirely. This will happen more often if the visitor is not familiar with your brand, and also when the page contents are slow to load. By Facebook’s estimation the GA tracking won’t fire anywhere between 10% and 80% of clicks on a mobile, but fewer than 5% of clicks on a desktop. It depends on what stage in the page load the GA pixel is requested. If you use a tag manager, you can control this firing order – so try firing the tag as a top priority and when the tag container is first loaded. Pro Tip: you can also use Google's mobile site speed suggestions to improve mobile load speed, and reduce this post-click drop-off. 3. A Javascript bug is preventing GA receiving data from in-app browsers It’s possible your page has a specific problem that prevents the GA tag firing only for mobile Safari (or Android equivalent). You’ll need to get your developers to test out the landing pages specifically from Facebook’s app. Luckily Facebook Ad Manager has a good way to preview the adverts on your mobile. Facebook Revenue vs GA Ecommerce revenue 4. Attribution: post-click vs last non-direct click Currently, Facebook has two types of attribution: post-view and post-click. This means any sale the user makes after viewing the advert or clicking on the advert, within the attribution window (typically 28 days after clicking and 1 day after viewing), is attributed to that advert. GA, by contrast, can use a variety of attribution models, the default being last non-direct click. This means that if the user clicks on an advert and on the same device buys something within the attribution window (typically 30 days), it will be attributed to Facebook.  GA doesn't know about views of the advert. If another campaign brings the same user to your site between the Facebook ad engagement and the purchase, this other campaign takes the credit as the ‘last non-direct click’. So to match as closely as possible we recommend setting the attribution window to be '28 days after clicking the ad' and no 'after view' attribution in Facebook (see screenshot above) and then creating a custom attribution model in GA, with the lookback window at 28 days, and the attribution 'linear' The differences typically come when: a user engages with more than one Facebook campaign (e.g. a brand campaign and a re-targeting one) where the revenue will only be counted against the last campaign (with a priority for ads clicked vs viewed) a user clicks on a Facebook ad, but then clicks on another advert (maybe Adwords) before buying. Facebook doesn’t know about this 2nd advert, so will attribute all the revenue to the Facebook ad. GA knows better, and will attribute all (or part) of it to Adwords. 5. Facebook cross-device tracking The main advantage Facebook has over GA is that users log in to its platform across all of their devices, so it can stitch together the view of a mobile advert on day 1 with a purchase made from the user’s desktop computer on day 2. Here’s a fuller explanation. By contrast, unless that user logs into your website on both devices, and you have cross-device tracking setup, GA won’t attribute the sale to Facebook. 6. Date of click vs date of purchase In Facebook, revenue is attributed to the date the user saw the advert; in GA it is to the date of purchase. So if a user clicks on the advert on 1st September, and then buys on the 3rd September, this will appear on the 1st on Facebook – and on the 3rd in GA. 7. The sampling problem Finally, did you check if the GA report is sampled? In the top right of the screen, in the grey bar, you'll see that the report is based on a sample.  If that sample is less than 100% it means the numbers you see are estimates.  The smaller the sample size used, the larger the possibility of error.  So in this example, a 45% sample of 270,000 sessions could skew our results plus or minus 0.2% in the best case. As a rule of thumb, Google applies sampling when looking over more than 500,000 sessions (even if you select the 'greater precision' option from the drop-down menu). You can check your own sample using this confidence interval calculator. Conclusion Altogether, there’s a formidable list of reasons why the data will never be an exact match, but I hope it gives you a way to optimise the tracking. Please let us know if you’ve seen other tracking issues aside from these.   Get Social! Follow us on LinkedIn, Twitter, and Facebook and keep up-to-date with our Google Analytics insights.

2017-02-08

Cross Domain tracking for Eventbrite using Google Tag Manager (GTM)

Are you using Eventbrite for event registrations? And would you like to see the marketing campaign which drove that event registration correctly attributed in Google Analytics? Then you've come to right place! Here is a simple guide to adding a Google Tag Manager tag to ensure the correct data is sent to Eventbrite to enable cross-domain tracking with your own website. Many thanks to the Lunametrics blog for their detailed solution, which we have adapted here for GTM. Before this will work you need to have: links from your site to Eventbrite (including mysite.eventbrite.com or www.eventbrite.co.uk) the Universal Analytics tracking code on both your site and your Eventbrite pages. only have one GA tracking code on your own site - or else see the Lunametrics article to cope with this 1. Create a new tag in GTM Create a new custom HTML tag in GTM and paste this script: [code language="javascript"] <script> (function(document, window) { //Uses the first GA tracker registered, which is fine for 99.9% of users. //won't work for browsers older than IE8 if (!document.querySelector) return; var gaName = window.GoogleAnalyticsObject || "ga" ; // Safely instantiate our GA queue. window[gaName]=window[gaName]||function(){(window[gaName].q=window[gaName].q||[]).push(arguments)};window[gaName].l=+new Date; window[gaName](function() { // Defer to the back of the queue if no tracker is ready if (!ga.getAll().length) { window[gaName](bindUrls); } else bindUrls(); }); function bindUrls() { var urls = document.querySelectorAll("a"); var eventbrite = /eventbrite\./ var url, i; for (i = 0; i < urls.length; i++) { url = urls[i]; if (eventbrite.test(url.hostname) === true) { //only fetches clientID if this page has Eventbrite links var clientId = getClientId(); var parameter = "_eboga=" + clientId; // If we're in debug mode and can't find a client if (!clientId) { window.console && window.console.error("GTM Eventbrite Cross Domain: Unable to detect Client ID. Verify you are using Universal Analytics."); break; return; } url.search = url.search ? url.search + "&" + parameter : "?" + parameter; } } } function getClientId() { var trackers = window[gaName].getAll(); return trackers[0].get("clientId"); } })(document, window); </script> [/code]   2. Set the tag to fire 'DOM ready' Create a new trigger (if you don't have a suitable one) to fire the tag on every page at the DOM ready stage.  We need to make sure the Google Analytics tracker has loaded first. 3. Test the marketing attribution With the script working you should see pageviews of the Eventbrite pages as a continuation of the same session. You can test this by: Opening the 'real time' reporting tag in Google Analytics, on an unfiltered view Searching for your own site in Google Navigating to the page with the Eventbrite link and clicking on it Looking under the Traffic Sources report and checking you are still listed as organic search after viewing the Eventbrite page Need more help? Comment below or get in touch!   Get Social! Follow us on LinkedIn, Twitter, and Facebook and keep up-to-date with our Google Analytics insights.

2017-02-07

3 reasons you should be using Google Tag Manager for Shopify

Anyone running a Shopify store knows there are hundreds of Shopify apps, integrations and connections in the ecommerce world that can help you grow faster. But from Google Ads, DoubleClick, and Facebook Ads to custom plugins, many tools require you to insert scripts on the pages that need tagging, and for a lot of store owners, this can be a huge hassle without asking for developer help. Google Tag Manager (GTM) can launch new tags with just a few clicks. As the world's most popular enterprise-grade tag management solution, Google Tag Manager supports both Google and third-party tags. We've written quite a few articles on Google Tag Manager (including a full FAQ) and how to use it, but until now, we haven't dug deep into why you should use GTM. Here are 3 reasons why: 1. Reliable and accurate ecommerce data When your tags aren’t working properly, they can hurt your site performance, resulting in slow load times, website unavailability, or a loss of functionality. That’s why it’s critical to have a tag management solution in place that allows you to quickly determine the status of your tags. Easy-to-use error checking and speedy tag loading in Google Tag Manager means you know for certain that every tag works. You can rest assured knowing your mission-critical data is being collected reliably and accurately! Your IT team will also feel confident that the site is running smoothly, so everyone's happy, even during busy holidays or the launch of a new campaign. Large brands have implemented GTM to launch their tags exactly for this reason: reliable and accurate ecommerce data. PizzaHut, Made.com, AgeUK and many other brands running on Shopify use GTM to manage their tags for Google and third-party platforms. Setting up Enhanced Ecommerce via GTM In Google Analytics, the main benefit of using Enhanced Ecommerce tracking (EEC) over standard ecommerce implementation is the amount of valuable reports you have access to as a merchant with EEC. But that's not all—you can also segment data based on ecommerce events, such as: Which users visited your product pages Where your shoppers hit a roadblock in the customer journey (e.g. a shopper viewed a product but never added to cart) Which step of the checkout process a shopper abandoned cart This kind of data helps you zoom in on your sales funnel and update the parts of the process that either stall conversions or slow down the path to purchase. Enchanced Ecommerce implementation is no walk in the park, but it does depend on a few things: How large is your store? How many Google Analytics custom dimensions do you need to add? What type of custom dimensions? etc. Without question, Google Tag Manager is the easiest way to enable Enhanced Ecommerce in Google Analytics — and we can help with that! Do you already use GTM? If you already use GTM to track page views, you must send ecommerce data via Google Tag Manager. If you don't already use GTM...It’s a simple setup: activate EEC within your Google Analytics tags and use a dataLayer as an ecommerce data source. Just make sure the dataLayer contains all ecommerce data! 2. Quickly deploy Google and third-party tags With so many tracking tools out there, marketers need flexibility—whether that’s changing tags on the fly or having the ability to easily add tags from other sources. In GTM, marketers can add or change their own tags as needed. Google Tag Manager supports all tags and has easy-to-use templates for a wide range of Google and third-party tags for web and mobile apps. Don’t see a tag listed? You can add it immediately as a custom tag. With this much flexibility, your campaign can be underway with just a few clicks. Even if you are using Google Ads (Adwords), Adroll, Facebook, Hotjar, Criteo or your own script, you can implement it with Google Tag Manager. Even if you're a publisher as, let's say, nationalgeographic-magazine.com, sell furniture at Made.com, sell event tickets as eventbrite.com or organise courses as redcrossfirstaidtraining.co.uk, GTM is the best way to organise all the scripts your partners provides. 3. Collaborate across the enterprise and make tag updates efficiently Collaboration across a large team can be a challenge. Not having the proper tools can stall workflows, which decreases productivity and efficiency. Workspaces and granular access controls allow your team to work together efficiently within Google Tag Manager: Multiple users can complete tagging updates at the same time and publish changes as they’re ready Multi-environment testing lets you publish to different environments to ensure things are working as expected I don't know about you, but every time I need to add a new script on my website, I hesitate out of fear my website will break and I wouldn't know how to fix it. I wanted a solution where I could add a script on my own, test it and then publish it without any developer help. And then I found Google Tag Manager. GTM lets you collaborate and work independently, at the same time, on the same website. You can publish a tag at the same time your teammate is creating an A/B testing experiment, all in the same GTM container. Adding Google Tag Manager to Shopify will help increase the value of your store and the accuracy of your Shopify tracking. GTM is free, it's reliable, and you can find plenty of how-tos on online so you can start using it right away. Google Tag Manager currently provides out-of-the-box integrations with: Google Analytics AdWords Conversion Tracking AdWords Remarketing (aka Google Ads, which we integrate with for accurate marketing attribution) DoubleClick Google Optimize (which we have a connection for!) Google Surveys Website Satisfaction - Google Surveys AdRoll Crazy Egg Hotjar LinkedIn Yieldify and more This out-of-the-box integration doesn't require any special knowledge. And, for any other script that you might have, we can walk you through the process of integrating Google Tag Manager and Shopify. Questions about GTM? Get in touch with our team of Shopify experts and Google Analytics consultants!   Quick links Building funnels and triggering other marketing tags in GTM How to set up Enhanced Ecommerce tracking via GTM Google Tag Manager FAQ Connecting your Google Analytics store for accurate Shopify tracking

2016-12-13

New interface and workspaces in Google Tag Manager

Google Tag Manager has recently had quite a revamp to its interface. Not to mention the addition of much talked about workspaces feature. Google Tag Manager (GTM) is a great tool that saves the development and implementation time, and the new drastic changes in any of Google’s tools can be quite a shock when you’re used to one way of workflow. The latest changes to the interface are radical but as with everything else, it just takes a short while to get used to. GTM still works the same, though. There’s no change to how your tags, triggers and variables are set up. So let’s see what's changed! Overlays on top of overlays This is the biggest change in the interface! Whether you’re creating a new tag or changing an existing one, you’ll be making your updates in overlays that slide in from the right hand side of the screen. Whilst this may be confusing initially, this is a great improvement on the previous workflow. Before you had to create your variables before the tag, or if creating the tag, save the progress, then create the variable separately, and then return to the tag to add in your variable. Too many steps! The new overlay doesn’t cover the whole screen and instead, leaves a bit of space on the left so you can see where you started from. Now that I’ve embraced the workspaces, I’ve realised how great it is to be able to do changes and updates without navigating elsewhere. Icons replace colours Previously, when viewing a list of tags all the triggers were colour coded so you could quickly see types of triggers used. Now, they’re all grey with icons at the beginning. I’ve previously found the colour coding very handy in quickly determining where the tags have been set to work. I’m not convinced that the icons will do as great of a job, but like with all of the changes – just embrace them and move on. List of variables They’ve lost the ‘enabled built-in variables’ section at the top. It used to have checkboxes so you could quickly enable or disable select variables. Now you have a list of built-in variables and for any changes, you have to click ‘configure’ button and then select which ones you want or not. And of course, you’ll have to do these changes in the overlay that slides over. The variables you've created previously will be in a separate list when you scroll down the page. If you want to view the details of the variable, then you’ll have to click on the variable and see its setup in the new overlay. Remember, remember… Do you tend to forget to specify your container's name and description? Now you get reminded to do so when you click to ‘publish’ your container and haven’t set the details. Timestamps I love it when a small change can make a big difference! This is that kind of change. When hovering over any relative timestamps in the triggers, overview or other sections, you will see the exact date and time of the latest change. What are workspaces? Workspaces are multiple containers that teams and users can work on without worrying about publishing someone else’s updates that may not be ready to go live. For someone working within a number of teams, like we do, this is a very welcomed update. After using it for a few weeks, I’ve already seen improvements in the speed of publishing updates. Now, fewer people have been blocked from progressing on their tags, which is really great! So now you can make your additions or amendments in a separate space and publish them when they're ready. What really happens when you publish is that anything new in your workspace gets added to the default workspace. This may include any updates to tags, triggers, variables, and any notes you may have added. If you can, stick to making smaller sets of changes within workspaces so you have a more robust version history, allowing you to trace updates and roll back to previous versions more quickly. You’ll get 3 workspaces in total so 1 default one + 2 custom workspaces, whilst 360 accounts get unlimited workspaces. Here’s how they work. To create a separate workspace click on the ‘Default Workspace’ in the left panel. In the new overlay click on the + icon in the top right corner. Now enter the name and description for the workspace so when you choose a workspace you can quickly see what's being worked on in there, or what the purpose of the workspace is. You can always refer to these for information on what was worked on or published as part of this workspace. A new workspace will always be created based on the latest GTM version and include the latest tags, triggers, and variables. If you're publishing a workspace that has conflicting updates with another workspace, then GTM will let you know and give you the option to resolve conflicts in their very easy to use conflict resolution tool. Once you publish the non-default workspace, it will be automatically removed. Better tag management You know how GTM has a number of tag templates for the most typical tracking needs, for example, AdWords and DoubleClick. These templates are very useful for creating and maintaining tags without codes, allowing to insert only required data, and making the whole process less error-prone. Well, they've expanded their selection with additional templates from vendors such as Bing, Twitter, Hotjar, Nielsen, Yieldify and many many more. I've been setting up a number of tags from the new vendors so I'm glad to see they've finally caught up with this. Here's a full list of supported tags is available in Tag Manager's Help section.   So these are some of the most notable changes. My favourite ones are overlays, timestamps and workspaces for reasons I mentioned above. The overlays don't seem to have got much love when they were first launched, but it's definitely a step up on the previous workflow. Got strong feelings about any of the latest updates? Let me know what you love or hate in the comments below.   Get Social! Follow us on LinkedIn, Twitter, and Facebook and keep up-to-date with our Google Analytics insights.   Image credit: screenshot of 'conflict resolution tool' courtesy of Google Analytics Blog

2016-10-13

How to track forms which don't redirect to a thank you page

Many contact forms now use Javascript to submit and do not redirect to a new page. So to track the form, unless you trigger an event on the submit button, you need to listen for a piece of text (usually saying thank you). We have created a custom HTML script that listens to the changes in the page and triggers an event called 'formSubmitted'. This event can then be used to fire a separate tag with event details to Google Analytics. We've tested this on our contact form at Littledata and here's how you can set it up too. [subscribe] Step 1 The first step is to go through the contact form and see what the steps are in completing it. On ours, you just enter the information in the fields and press "SUBMIT MESSAGE". When the message is sent out, the button will say "SENT!". Here the only thing that changed was the text on the button from 'submit message' to 'sent'. We built this HTML script that listens to the changes on the page, but you'll need to change line 10 to be whatever the message is in your form. You will also need to change line 15 if you have multiple forms on the page. [code lang="js"] &lt;script&gt; // **** Littledata Javascript form tracker **** // Generates a GTM custom event called 'formSubmitted' // When an on-page form is submitted // CHANGE the text to match the message displayed // when the form is successfully completed // It is not case sensitive var text = "sent!" // By default it will search for text within the first form // Set to false if text is outside a form // or change to a higher false if there are multiple forms var formIndex = 0; // OPTIONALLY, restrict the search to an HTML element ID // If you leave this blank, the whole page will be searched; // this causes the script to run more slowly var targetId = "" // **** No changes needed to the script below **** text = text.toLowerCase() dataLayer = dataLayer || []; if (!formIndex &amp;&amp; targetId.length == 0) console.error('Form tracker needs either a form or an element ID') var checkEveryMilliseconds = 500; formTrackerInterval = window.setInterval(function(){ var target = "" if (formIndex &gt;= 0) { var form = document.getElementsByTagName('form') target = (form.length &gt; 0) ? form[formIndex].textContent : ""; } else target = document.getElementById(targetId).textContent target = target.toLowerCase() if (target.indexOf(text) &gt; -1) { window.clearInterval(formTrackerInterval); dataLayer.push({ event: 'formSubmitted' }) } },checkEveryMilliseconds) &lt;/script&gt; [/code] Step 2 Now we need to add the script to listen out for when the form is submitted. Create a custom HTML tag in your GTM container. You can name the tag 'LISTENER Contact form submit event' or anything else you will remember it by. Choose the tag type 'Custom HTML'. Copy and paste your HTML/Javascript into the textbox, and remember to change the var text (line 10) with your own text. Step 3 This tag needs a firing trigger, specifying the rules when it needs to be activated. If you can, only fire on specific pages - the script will slow down the page a little, as it runs every half a second to check the form. Give the trigger a descriptive name - here I've chosen "PAGE About us" Select trigger type as 'Custom Event' and for the event name put " gtm.load ", which means this trigger at page load. We want this trigger to work on a specific page only, so the firing rule goes 'page path equals /about-us', which means that our trigger will work on the www.littledata.io/about-us page only. If you have a number of pages that have the form you're tracking, then you could use 'contains' rule and select part of the link that is applicable to all. For example, if all of your links have word 'contact' in them, then your firing rule would say 'page path contains contact'. Step 4 Now that you have your listener tag set up, you need to create a separate tag to send the event details to Google Analytics. Again, give it a descriptive name so you know what it's for - here I've used 'GA event - contact form submitted'. Select tag type as 'Universal Analytics' and in the tracking ID field, select the variable that contains your GA tracking id. For event category, action and label you have to specify the namings by which this data will be categorised in Google Analytics. Step 5 This tag needs its own trigger to know when to fire, and here you have to use the event created by the listener tag set up during steps 2-3. Here you have to specify that this tag can only fire when event 'formSubmitted' happens. I've called my trigger 'Contact form event', selected trigger type as 'custom event' and entered event name 'formSubmitted. Now you can save it and test in the debugger mode. Try submitting your contact form and see if the event 'formSubmitted' appears. You should also see the tag 'GA event - contact form submitted' fire. If everything's ok, publish the container and do a final test. Make a new form submission and check if you can see the event details come through in Google Analytics real time reports, under events. Need some help setting this up or Google Tag Manger? Get in touch with our lovely Google Analytics experts! If you're looking for more advanced help, our Google Analytics consulting team is here to help, too.   Further reading: How to set up event tracking in Google Tag Manager Why should you tag your campaigns? Set up Ecommerce tracking with Google Tag Manager

2016-10-11

Personally Identifiable Information (PII), hashing and Google Analytics

Google has a strict policy prohibiting sending Personally Identifiable Information (PII) to Google Analytics. This is necessary to provide GA reports around the world, yet comply with country regulations about storing personal information.  Even if you send personal information accidentally, Google may be forced to delete all of your analytics data for the time range affected. This policy has recently tightened to state: You may not upload any data that allows Google to personally identify an individual (such as names and email addresses), even in hashed form. A number of our clients are using a hashed email as the unique identifier for logged in users, or those coming from email campaigns.  If so, this needs be a minimum of SHA256 hashing (not MD5 hashing), with a 'salt' to improve the security - check your implementation meets the required standard. If you want to check if personal information affects your analytics, we now include checking for PII in our complete Google Analytics audit. Google's best practice for avoiding this issue is to remove the PII at the source - on the page, before it is sent to Google Analytics.  But it may be hard to hunt down all the situations where you accidentally send personal data; for example, a form which sends the user's email in the postback URL, or a marketing campaign which add the postcode as a campaign tag. We have developed a tag manager variable that does this removal for you, to avoid having to change any forms or marketing campaigns which are currency breaking the rules. Steps to setup 1. Copy the script below into a new custom Javascript variable in GTM [code language="javascript"]function() { // Modify the object below to add additional regular expressions var piiRegex = { //matches emails, postcodes and phone numbers where they start or end with a space //or a comma, ampersand, backslash or equals "email": /[\s&\/,=]([a-zA-Z0-9_.+-]+\@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+)($|[\s&amp;;\/,])/, "postcode": /[\s&\/,=]([A-Z]{1,2}[0-9][0-9A-Z]?(\s|%20)[0-9][A-Z]{2})($|[\s&amp;\/,])/, "phone number": /[\s&\/,=](0[0-9]{3,5}(\s|%20)?[0-9]{5,8}|[0-9]{3}-[0-9]{4}-[0-9]{4})($|[\s&amp;\/,])/ }; // Ensure that Page URL Variable is updated to match the Variable in your // GTM container to retrieve the full URL var dl = {{Page URL}} var dlRemoved = dl; for (key in piiRegex) { dlRemoved = dlRemoved.replace(piiRegex[key], 'REMOVED'); } return dlRemoved; }[/code] 2.Check {{Page URL}} is set up in your GTM container This is a built-in variable, but you'll need to check it under the variables tab. 3. Change the pageview tag to override the standard document location, and use the variable with PII removed   By default, Google Analytics takes the location to be whatever is in the URL bar (document.location in Javascript).  You will over-ride that with the PII-safe variable.

2016-08-03

How to use the lookup table variable in Google Tag Manager

A lookup table in Google Tag Manager makes it much simpler to manage lots of values in your tracking setup. It can drastically reduce the number of tags required and turn your messy GTM into a neat environment. It's especially useful with larger setups where you have multiple tracking requirements and flexible to accommodate new tracking needs as they arise. You can easily add or remove values from your lookup tables, and not worry about having to change any codes. The lookup table variable allows you to define a set of key-value pairs where the output variable (the value that you are sending to Google Analytics) is linked to the identifier (the key). It works like this: When [input variable] equals to  _______, set [this output variable] to_______. For example, you could use the lookup table for: Assigning different Google Analytics property IDs for various domains/hostnames, eg. when [website hostname] equals to littledata.co.uk, set [property ID] to UA-010101 (see example below) Setting different pixel or conversions IDs for different country websites, eg when [website country code] equals to 2, set [pixel ID] to 88779 (requires having website country code variable defined) Defining your event categories, actions and labels (see example below) Remember! There’s no limit to how many values you can have in the lookup table, but the fields are case sensitive. So if you have multiple capitalisations of some input, then include all of them in the lookup table and assign the same output for each. I have previously explained setting up the tracking of user actions as events in GTM, but when you need to track multiple events, one tag just doesn't cut it anymore. And instead of creating several tags to cover each event or action, here's how you would create the lookup table to cover multiple values in one place. Creating lookup table variable for event parameters In the Littledata software interface, you get an option to switch between different report types or view them all. I want to track when people click on different report types, so instead of creating 5 different tags for each user action, I will set up a lookup table to cover all of them in one place. But firstly I need to know which variable to use as the input. You can only have one type of input variable per the lookup table so you want to pick a variable type that applies to each (ideally). For this, I will check how each report type option has been set up in the code by inspecting the element (inspect/inspect element depending on the browser you're using and usually accessible via right click). Here's how each report type has been set up: <a href="/report-list/m2i4MnmXcewDSzZ3c/all" class="current" id="ga-all">All <span class="count">120</span></a> <a href="/report-list/m2i4MnmXcewDSzZ3c/trends" class="" id="ga-trends">Trends <span class="count">80</span></a> <a href="/report-list/m2i4MnmXcewDSzZ3c/pages" class="" id="ga-pages">Pages <span class="count">37</span></a> <a href="/report-list/m2i4MnmXcewDSzZ3c/tips" class="" id="ga-tips">Tips <span class="count">3</span></a> <a href="/report-list/m2i4MnmXcewDSzZ3c/benchmark" class="" id="ga-benchmark">Benchmark <span class="count">0</span></a> Looking at the above, I can see that each report type has a unique ID - here that's the best one to use. Now to set this up, go to Variables, click ‘New’ and select 'Lookup Table' as your variable type. For the input variable, I will use {{Click ID}} as explained above, but you, of course, use whatever unique identifier you have available. For your output, you want to define the event action you are going to send to the Events report in Google Analytics. Should you set the default value? You can set a default value for the output when there is no match found in your table. With the event tracking, I sometimes find it useful to enable to identify if I set up my tag correctly. If my trigger ends up being too broad, the default value option will pick up additional values not defined in the table. I will then see these values in Google Analytics reports and this way I can tidy up the trigger to be more accurate. So this is what your variable should look like now. Click ‘Create Variable’ and there you have it. In your GA event tag, the newly created variable would look like this. Other uses Multiple Google Analytics properties If you have a single GTM container installed on multiple domains but you're tracking them across different Google Analytics properties, you want to ensure that you're sending the data to the correct one. Instead of having multiple variables to store different property IDs, you can have them all neatly in the same table defined by the hostname. This way any tracking activity on each site will go to its own dedicated property. Excluding test or other data If you want to make sure that any data outside of your main site goes to a test or other Google Analytics property, you can do so by setting the default value. The default value is the output that is not found in the table. With this setup, any activity tracked on www.mainsite.com goes to property ID UA-121212. If the activity wasn't on www.mainsite.com, then it sent to property ID UA-121212-2. Use lookup tables for something else? Confused? Get in touch or comment below!

2016-03-09

How to set up event tracking in Google Tag Manager

Events in Google Analytics are important for understanding how people interact with your website. They give you additional insight into their behaviour and how effective your pages are for leading users towards a conversion. With event tracking you could see how many users clicked on a button or played a video, scrolled down a page or clicked on your contact and social media icons. I mostly use Google Tag Manager (GTM) for analytics setup so I will show how to set up event tracking for clicks on buttons with GTM. Instead of hard coding events in the code, GTM allows you to create, test and amend tags within its interface. Before you go ahead creating your event tags, make sure your built-in pages and clicks variables are enabled. This will avoid you having to go back and forth between different sections. The setup below covers only one action - a click on a specific button - but if you have multiple actions to track, then look into implementing a lookup table variable. Tracking button clicks Here's my scenario. I want to track our BENCHMARK YOUR SITE button that allows users to sign up to our free software plan and get benchmarked against competitors.   And here's how to set it up. 1. Create a tag It will be a Universal Analytics tag type where tracking ID is a constant string variable (you need to create this variable before using it) and track type 'Event'. Think of your event tracking parameters as a way to organise the events into a hierarchy: Category – the main aim of the button or its placement Action – what the user clicked or the action Label – provides additional information like on what page the button was clicked or the outbound link they clicked on Value – if you have a numerical value to set for your click (not in my case tho) In my example, the category is ‘Get started’ because we have a number of similar buttons across the site with the same purpose to get the user started with the signup, so all of them have the same event category. For action, I specify the type of button that was clicked on so I can compare how these different buttons perform - 'Benchmark your site' in this case. My event label is the {{Page Path}} where they clicked on the button. The buttons take the user to the same place so I’m more interested in which pages these buttons were clicked on. Alternatively, if you have buttons that take people to different URLs you might want to track that instead. Is it a non-interaction hit? This is an important one to keep in mind. By default this is set to False. If you don’t want this event to impact your bounce rate, then change it to True, which you would do if the click or action didn’t take the user to the new page, or if you didn't want it to be included in your bounce rate calculations. Now click 'Continue' to go to the trigger setup. 2. Create a trigger Trigger is like a rule that allows you to tell the tag, ie specify the conditions, when it should fire. Under 'Fire On' select ‘Click’ as your trigger type and then ‘New’. For configuring the trigger, you have a choice between two types: Just Links – use this when the target is a link or anchor tag <a> All Elements – use this when the target is any other element that’s not a link To determine what’s best for your purposes you need to have a look at how your button is set up. You can do this by selecting ‘inspect element’ or simply ‘inspect’ depending on what browser you’re using. It’s usually available when you right click on the button or element.   Our button has been set up the following way: <a href="https://littledata.uk/signup" class="btn btn-ltd btn-green">benchmark your site</a> It has a link so I will use 'Just Links' for targets and I have a choice between three elements to use in further configuration: https://littledata.uk/signup as click url btn btn-ltd btn-green as click class benchmark your site as click text It is best to use a unique condition if you can. This way, if similar class or click url gets reused in other parts of the website you don't have to go back to this trigger to update it. With 'Just Links' you will get additional configuration options: Wait for tags - delays opening of links until all other tags have fired or the wait time has lapsed, whichever happens first Check validation - fires the tag only when opening the link was a valid action, without the tag will fire whenever the user clicks on the button/link Enable when - this options is shown only when either of the above is ticked so you can be specific about where you want the trigger to be active If you want the trigger to listen to the interactions on all pages, then set that section to be  URL or Page Path matches regex .*. (without that very last full stop - that one's for the sentence) In my case, I only want it to work on benchmark pages and all of them start with /benchmark/. The very last step in trigger setup is specifying on which actions or clicks the tag should fire. As said above, I'm using the button's click class here. All done? This is what your tag should now look like. Click 'Create Tag'. 3. Test Test your tag in GTM's preview mode by checking two things: the tag fires in the preview interface, and the tag is seen in Google Analytics real time view under 'Events' with the event parameters you specified   I hope you got on with the setup above just fine, but if you have questions or clarifications, feel free to ask below.   Further reading: Know who converts on your site with Google Analytics goals Using lookup table variable in Google Tag Manager Intro to Google Tag Manager's key concepts and terminology Image: Courtesy of suphakit73 at FreeDigitalPhotos.net  

2016-03-02

Try the top-rated Google Analytics app for Shopify stores

Get a 30-day free trial of Littledata for Google Analytics or Segment