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. 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"] <script> // **** 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 && 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 >= 0) { var form = document.getElementsByTagName('form') target = (form.length > 0) ? form[formIndex].textContent : ""; } else target = document.getElementById(targetId).textContent target = target.toLowerCase() if (target.indexOf(text) > -1) { window.clearInterval(formTrackerInterval); dataLayer.push({ event: 'formSubmitted' }) } },checkEveryMilliseconds) </script> [/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? Why not get in touch by contacting our lovely Google Analytics experts?   Get Social! Follow us on LinkedIn, Twitter, and Facebook and keep up-to-date with our Google Analytics insights. 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

Create and customise dashboards and widgets in Google Analytics

Every view in Google Analytics comes with a default "My Dashboard". Learn how to customise your dashboards and widgets for the best account overview. Dashboards contain one or more widgets (up to 12 per dashboard) that give you an overview of the KPI’s that you care about most. Create your dashboard To create a dashboard, navigate to your view, then: Go to reporting tab. Click dashboards. Select + new dashboard. In the create dashboard pop-up select blank canvas (no widgets) or starter dashboard (default set of widgets). You can also import dashboard configurations from the solutions gallery, where is most likely that someone thought about some of the KPI’s you are interested and already build a dashboard. Give your dashboard a title, then click create dashboard. Add widgets to your dashboard A dashboard can have up to 12 instances of the following kinds of widgets <piece of information>: Metric—displays a simple numeric representation of a single selected metric. Timeline—displays a graph of the selected metric over time. You can compare this to a secondary metric. Geomap—displays a map of the selected region, with the specified metric plotted on the map. Hover over the map to see the actual metric values. Table—displays up to 2 metrics describing the selected dimension, laid out in a tabular format. Pie—displays a pie chart of the selected metric grouped by a dimension. Mouse over a slice to see the specific metric values. Bar—displays a bar chart of the selected metric grouped by up to 2 dimensions. Mouse over a slice to see the specific metric values. Difference between standard vs. real-time widgets Some of the available widgets can display their data in real-time. These widgets update the metrics automatically (standard widgets, by comparison, update when you load or refresh the dashboard). Real-time widgets can display only the active users or pageviews metrics, depending on the widget. The following widget types are available as real-time widgets: Counter—displays a count of the active users on your site. You can optionally group these users by a selected dimension. Timeline—displays a timeline graph of pageviews on your site for the past 30 to 60 minutes. Geomap—displays a map showing where your active users are coming from. Table—plots a table of your active users against up to 3 selected dimensions. How to add a widget to a dashboard: Create a new dashboard and select blank canvas, or click + add widget on an existing dashboard to open the widget editor. Select the type of widget. Configure the widget’s dimensions, metrics and other options. These vary depending on the type of widget. Scroll or use the search box to locate the specific metric or dimension you want. You can limit the data shown by the widget by clicking add a filter. Filters let you include or exclude data in the specified dimension that match your filter criteria. You can add multiple rows to your filter definition. All conditions must be met for the filter to work. Report and dashboard filters are not the same as view filters. View filters permanently change your data, while report and dashboard filters only limit the data displayed in the report or dashboard. Dashboard filters are specific to the dashboard in which you define them. You can link the widget to a report or a URL. Doing so makes the widget title a link, taking you to the specified report or web page. To link to a report, begin typing a report name. Google Analytics will autocomplete your entry, trying to match it to an existing report. Alternatively, you can copy and paste the report’s URL into this field. Enter a widget title or accept the suggested title. Click save. Add a linked report directly to your dashboard Another way to link a report to your dashboard is to add it directly from the Google Analytics reporting tool. Locate or create the report you want to see in your dashboard. Click add to dashboard below the report title. Select an existing dashboard, or create a new one by clicking new dashboard. Select the check boxes for the dashboard widgets you want to include (e.g., table, pie chart, timeline). You can add up to 2 widgets per report to your dashboard. You can change the widget titles using the click to edit links. Click add to dashboard. Your new linked report widget opens on the dashboard you selected. Use the widget title link to open the underlying report. Linked report limitations Linked reports can’t have metric filters or secondary dimensions. If you try to add a report with a metric filter or secondary dimension, you will see a warning icon. Hover over the icon to see the warning message. You can still add the report, but it will not include the filter or secondary dimension. You can only embed the data view of a report in your dashboard. If you try to add a report that uses another view of the table (e.g., percentage, performance, comparison or pivot), you will see a warning icon. Mouse over the icon to see the warning message. You can still add the report, but it will display only the data view. Linked reports display only the first two metric columns from your reports. If your report contains more than two metrics, additional metrics will not be displayed in the dashboard. Edit a widget To modify an existing widget, mouse over the widget title, then click the edit (pencil) icon. To delete an individual widget, mouse over the widget title, then click the close (X) icon. Clone a widget You can create an exact copy of a widget using the clone widget link. This is convenient when you want to use one widget as a base for another. Add segments to your dashboard In the Google Analytics reports, you can add segments to your dashboard, allowing you to compare and contrast metrics generated by different session or user groupings. To edit an existing segment, click the segment label at the top of your dashboard. To add a segment, click the empty + add segment label. You can learn more about segments. Share your dashboard with other users Dashboards are private to you until you share them. If you develop a dashboard that you think is useful to other users in your account, or to other Google Analytics users in general, you have several options for sharing it. You can also send a snapshot of your dashboard data via email or generate a PDF file you can distribute however you please. Share dashboards with the current view Once you have your private dashboard working the way you like, you can create a copy of it to share with other users. When you do this, anyone with access to this view can see the dashboard’s data and add to or edit any widgets contained in the dashboard. There’s no way to make dashboards read-only; however, changes to the shared dashboard won’t affect your private version of that dashboard. You must have edit permission to share dashboards and data with the current view. If you have only read-only permission, you can still share your private dashboard by sending it as a template link or by adding it to the solutions gallery. See below for more information. To share a dashboard with the current view: View the dashboard you want to share. Click share > share object A copy of the current dashboard will now be available to all other users in that view, located in the shared dashboards section of the reports panel. Note: to unshare the dashboard you must delete it. Share dashboard templates with other views and accounts The share > share template link option generates a URL you can copy and send to other users, embed in a document or host on a website. When you share a dashboard via a template, you share only the settings for the dashboard - you do not share any data. You can send the link to anyone with a Google Analytics account, and that person can then import the settings. Learn more about sharing customizations via templates. Share dashboards in the solutions gallery The solutions gallery lets you share and import custom reporting tools and assets, like dashboards and segments, into your Google Analytics accounts. When you share a dashboard using the share > share in solutions gallery, only the dashboard’s configuration is shared. Your personal information and Google Analytics data stay private in your account. Learn more about the solutions gallery. Send dashboards via email If you need to distribute a snapshot of your dashboard data to people who might not have access to your Google Analytics account, the share > email option is for you. You can send them a customised email with an attached PDF file showing your dashboard to any valid email account. Scheduling dashboard emails Dashboard emails can be sent as “one-offs”, or you can schedule them on a recurring basis. Use the frequency controls to select the timing of the email. By default, recurring emails will be sent for 6 months. The advanced options let you adjust this from 1 month to 1 year. After this period expires, you’ll need to set up the recurring email schedule again. Tip: If there are any previously scheduled emails, you’ll see a link allowing you to add to an existing email. This lets you send out multiple dashboards or reports using the same distribution and timing. Manage all your scheduled emails by navigating to admin > views > select your view > personal tools & assets > scheduled emails. Export dashboards to PDF The export > PDF option saves a copy of your current dashboard exactly as it appears on screen to a PDF file. You can then embed or distribute this exported view in other documents as needed. Get Social! Follow us on LinkedIn, Twitter, and Facebook to keep up-to-date with Google Analytics.   Further reading: Vital Google Analytics custom reports and dashboards for ecommerce Attributing goals and conversions to marketing channels Tips to optimise your ecommerce landing pages

2016-10-04

How to set up internal searches in Google Analytics

Learn how to set up site search (internal search) with and without query parameters and see how users search your site. Find what your customers are researching for on your website and improve your website content. The site search reports provide data on the type of content people are looking for on your site. Having site search data is like reading the minds of a subset of your audience. You can easily see what they’re looking for, the words and terminology they are using and how quickly they found what they were looking for (or if they did at all). Site search must be set up for each reporting view in which you want to see user search activity. To set up site search for a view: sign into your analytics account, navigate to a view in which you want to set up site search then click view settings and under site search settings, set site search tracking ON. In the query parameter field, enter the word or words that designate an internal query parameter, such as "term,search,query". Sometimes the word is just a letter, such as "s" or "q". Enter up to five parameters, separated by commas. The simplest way to know what your query parameter is is to go to your site and perform a search for something, anything! On the following page, take a look at the URL – do you see your keyword? If your keyword appears at the end of a URL following a question mark, like this: http://www.yourwebsite.com/?s=your+keyword, this means that your website is using query parameters. If your keyword appears in the middle of the URL, with no query parameters, like this: http://www.yourwebsite.com/search/your-keyword/ then this means you need to use the Page Paths. How to identify search query parameters for Site Search with Queries If you’ve identified that your search keywords show up in the query parameter portion of the site, you’re in luck! This is the easiest way to set up Site Search. When you're searching on your website, you might see the URL like this: http://www.yourwebsite.com/?s=your+keyword, or in this example blog.littledata.io?s=internal+search. The query parameter is the bit between ? and =, which is 's' in this example. So you must use the query parameter ‘s’ when setting up the internal search in Google Analytics settings. Now to set this up in Google Analytics, follow these steps: Select whether or not you want analytics to strip the query parameter from your URL. This only strips the parameters you've provided, not any other parameters in the same URL. Select whether or not you use categories, such as drop-down menus to refine a site search. If you select 'no', you are finished. Click save changes. If you select 'yes': In the category parameter field, enter the letters that designate an internal query category such as 'cat, qc,'. Select whether or not you want analytics to strip the category parameters from your URL. Note that this only strips the parameters you provided, not any other parameters in the same URL. This has the same functionality as excluding the URL query parameters in your main view: if you strip the category parameters from your site search view, you don't have to exclude them again from your main view. Click apply How to set search terms for Page Path Search Terms (No Queries) Another common behaviour of site search is to have the terms appear within the page path instead of a query. Like this: http://www.yourwebsite.com/search/your-keyword/ To track this type of site search, an advanced filter should be used for views that will be using these reports. First, navigate to filters > new filter under your view. (Note: when adding a filter, you must have EDIT rights on the property level!) After choosing the filter name, select ‘custom’ and ‘advanced’ in the filter’s settings. Choose ‘request URI’ for field A since we are getting the information from the URI, or page path. Your site’s page path goes in the text box, so for this example, it would look like this: search/(.*). When we do this, we are telling Google Analytics to look at this page path and extract the characters from within the parentheses. The dot and asterisk are regular expressions representing any character and any number of characters - so we are storing anything after the slash. Field B will be blank since we are only concerned with extracting from the page path and nowhere else. The next field, ‘output yo’, is the one we are interested in. Now that we have stored the keyword from the URI, we need to output it to the correct dimension. In the drop-down menu, select ‘search term’ and type ‘$A1’ into the input box. This tells Google Analytics to grab the user-defined value from field A and output it as a search term. For the checkbox options below, only ‘field A required’ and ‘override output field’ need to be selected. See site search data To see the site search reports: sign into your analytics account, navigate to your desired account, property, and view, then select the reporting tab and under behaviour go to site search. Your report must look like this: Take into consideration that the report will be populated with data from the moment you activate the internal search or add the filter. It is not retroactive and may need 24h to you see the queries in your report. If you'd like to know more about how to set up internal searches in Google Analytics, get in touch with one of our experts! Further reading: Attributing goals and conversions to marketing channels 9 tips for marketers using Google Analytics Trust your Google Analytics data with correct setup Image credit: Image courtesy of hub.3dissue.net  

2016-09-22

How to use Littledata's software to monitor ecommerce performance

Littledata provides daily insights in your inbox. These include alerts on significant changes to your web traffic, tips on better tracking, and longer term trends in a daily summary email. All this, along with advice on how to act, will improve your ecommerce performance. Key performance indicators (KPIs) are the milestones to online success of an ecommerce store. Monitoring them will help ecommerce entrepreneurs identify problems and find solutions for better sales, marketing, and customer service goals. Once you have set goals and selected KPIs, monitoring those indicators should become an everyday exercise. And most importantly: performance should inform business decisions, and you should use KPIs to drive actions. Here are the most used reports in our Littledata software that monitor ecommerce performance: Sales Key Performance Indicators Hourly, daily, weekly, monthly Our web app generates reports, based on your traffic volume, on a daily, weekly, monthly or hourly schedule. This helps you keep up to pace with your campaign changes, your developer's releases, and your new interface changes. This way, you can react fast to changes. If your campaign is performing badly, you can see it at once and change it. If your developers release something and it breaks a page or the tracking code, you will see it fast and can correct it. Conversions The efficacy of conversion marketing is measured by the conversion rate, i.e. the number of customers who have completed a transaction divided by the total number of website visitors. The conversion rate is influenced by multiple factors. We track the conversion performance with reports like: Performance of the mobile devices Find out if you have errors on particular devices and check how the user can progress through the checkout flow on these devices. You may have some blocking steps on these particular phones or tablets like coding incompatibilities or a bad user interface. Campaign performance Find out how your new campaign is doing compared with the benchmark. We compare your campaign performance across all campaigns of its kind from your own website and others so you will know where to improve the moment the information is vital. Goal and purchases evolution across time Find out what days are the best for your sale and what days are the worst and schedule your budgets and actions accordingly. Read more about setting up goals in: 'Setting up a destination goal funnel' or find out about using Enhanced Ecommerce to optimise product listings. Marketing Key Performance Indicators: Site traffic In ecommerce, part of the conversion rate equation is the site traffic, which makes monitoring the amount of people that get on a website a big thing. We monitor the performance of the website traffic in multiple reports divided by other segments. The segments monitored can be turned on and off in the Control Panel section of each account under segments. The segments currently available are Direct, Paid Search, Organic Search, Referral, Email, Mobile and Tablet. Segmentation of your traffic puts light on what channels fluctuate at some point in time so you can correct it. Page views per visit Average page views per visit are an excellent indicator of how compelling and easily navigated your content is. The formula is the total number of page views divided by the total number of visits during the same timeframe. Sophisticated users may also want to calculate average page views per visit for different visitor segments. We track the page views per visit across your website and compare them with your benchmark so you can see if the customer journey can be more easy and compelling. Traffic source We track each channel that brings you traffic and spot when traffic sources drop or spike. We have a smart reporting system that calculates traffic sources from different segments so you can see each traffic source fluctuations, giving you the opportunity to react promptly. Have any questions about these reports? Just contact us and ask!   Further reading: Auditing web analytics ecommerce tracking Attributing goals and conversions to marketing channels Why do you need cross domain tracking

2016-09-14

Why do I need ecommerce tracking?

Only by using Google Analytics ecommerce tracking, can you match real sales data with website usage (including traffic source/medium). This sales analysis is required to understand the performance of your website landing pages and return-on-investment from marketing campaigns. The ecommerce reports allow you to analyse purchase activity on your site or app. You can see which products were bought, average order value, ecommerce conversion rate, time to purchase, discount vouchers used and checkout process funnels. Ecommerce tracking is useful not just for online shops but for all kinds of websites including event booking, courses / education, travel / hotels and so on. To see ecommerce data in Google Analytics, you need to: Enable ecommerce in Google Analytics Add the code to your site/app to collect ecommerce data. To complete this task, you'll need to be comfortable editing HTML and coding in JavaScript, or have help from an experienced web developer. Read how to Set up Ecommerce Tracking with Google Tag Manager. Based on this data, you can develop an understanding of: Which products sell well, and by inference, which products are best suited for your customer base. The revenue per transaction, and the number of products per transaction. For example, if the number of products per transaction is lower than you'd like, you might benefit from offering better quantity discounts, or offering free shipping if customers meet a minimum dollar amount. How long (in time and in the number of sessions) it takes customers to make the decision to purchase. If your sales cycle is stable or fluctuates predictably based on product or season, you can use this information (in conjunction with overall sales forecasts) to make reliable predictions about revenue. If customers routinely make numerous visits before they purchase, you might think about a site design that leads more easily to your purchase pages, or options that let users compare your products and prices to your competitors'. The difference between goals and ecommerce. A goal is only measured once in a visit. Think about it similar to pageviews vs. unique pageviews - once the goal has been 'triggered' to a visit, it can't be triggered again. On the other hand, there are no limitations on the number of transactions being measured during one session. Ecommerce is more powerful in that it allows you to analyse additional metrics.  For example, you can see how many visits occurred before the visitor decided to purchase. Many visitors on my site come back more than 7 times before they finally decide to purchase. Wow, interesting figures! Here is a list of the available metrics for ecommerce: If you have marketing campaigns and have no ecommerce tracking you are more likely struggling to calculate the return on your investment (ROI).  With both goals and ecommerce tracking, you will now have a full understanding of your customer journey and your customer life value (CLV). Analytics goals vs. ecommerce transactions, which to choose? Both of them!  If you have read my post carefully, you will understand that both of them have their strengths and limitations. We strongly advise to implement and configure goals and ecommerce. Need help configuring goals and/or ecommerce on Google Analytics? Get in touch with our experts!  

2016-08-09

Do I need the Google Analytics tracking code on every page?

The script which triggers the tracking events to Google must be loaded once (and only once) on every page of your site. To set up Google Analytics tracking, you’ll usually need either your Analytics tracking ID or the entire Javascript tracking code snippet. This corresponds to your Analytics property. To find the tracking ID and code snippet: Sign in to your Analytics account. Select the Admin tab. Select an account from the drop-down menu in the ACCOUNT column. Select a property from the drop-down menu in the PROPERTY column. Under PROPERTY, click Tracking Info > Tracking Code. The snippet provided here must be implemented on every page, even the pages you are not interested in. If you chose to not include the code on every page then: you will not be able to see the full flow of a client on your website you will have inaccurate data about the time spent on site and actions taken visits to untracked pages will appear as 'referrals' and so will skew the volume of sessions marketing campaigns to the untracked pages will be lost The easy way for an established website to see if the tracking is complete is to go in Google Analytics -> Acquisition -> Referrals and search in the report after the name of your website, as shown below, or you can use Littledata's audit tool. Choose how to set up tracking There are several ways to collect data in Analytics, depending on whether you want to track a website, an app, or other Internet-connected devices. Select the best installation method for what you wish to track. Here is the complete guide from Google. Once you have successfully installed Analytics tracking, it may take up to 24 hours for data such as traffic referral information, user characteristics, and browsing information to appear in your reports. However, you can check your web tracking code setup immediately. If you don’t think it's working correctly Check your Real-Time reports or use Use Google Tag Assistant to verify your setup.   Get Social! Follow us on LinkedIn, Twitter, and Facebook and keep up-to-date with our Google Analytics insights.

2016-08-04

Attributing goals and conversions to marketing channels

On most websites, the conversion journey involves many different routes and across many sessions: few customers buy from the first advert. You may have heard of the ‘rule of 7’. In reality, it varies from maybe 2 or 3 touches for a $20 purchase and definitely more than 10 for an enterprise business service. Your company is buying prospects (or traffic) from a number of online channels, and in many cases, it will be the same potential customer coming from different sources. To be able to report on this in Google Analytics, we need to get the basic setup correct. Tagging campaigns for attribution The first step is to make sure that the different traffic sources can be compared in a multi-channel report are consistent and have complete inbound link tagging. Be sure to tag your campaign correct with our URL Builder. Some tools (such as Bing or Mailchimp) have options to turn on link tagging for GA - although it's buried in the settings. With many others, you will have to add the necessary ‘UTM’ parameters onto the link. Without this tagging, many sources will be misattributed. For example, affiliate networks could send referrals from any of thousands of websites which will appear under the ‘referrals’ channel by default. Facebook ads, since the majority come from the Facebook’s app, will appear under the ‘direct’ (or ‘unknown’) channel. From when full tagging is in effect, the channels report will start to reflect your genuine traffic acquisition source. But don’t expect a 100% match with other tracking tools – see our article on Facebook – GA discrepancies. Importing cost data The cost for any Google AdWords campaigns can be imported automatically, by linking the accounts, but for any third party campaigns, you will need to upload a spreadsheet with your costs on. The benefit is that now you can see the return on investment calculation update in real-time in the multi-channel reports. Model attribution The final step is to decide how you will attribute the value of a campaign if it forms part of a longer conversion pathway. The default for Google Analytics (and most others) is ‘last non-direct click’. That means that the most recent TAGGED campaign gets all the credit for the sale. If the user clicks on 5 Facebook ads, and then eventually buys after an abandoned basket email reminder, that email reminder will get all the sales (not Facebook). This attribution is what you’ll see in all the standard campaign and acquisition reports. You may feel that it is unfair on all the work done by the earlier campaigns, so ‘linear’ (sale equally credited to all tagged campaigns) or ‘time decay’ (more recent campaigns get more credit) may be a better fit with your businesses’ goals. Conclusion Multi-channel marketing performance attribution is not a luxury for the largest companies. It’s available to you now, with the free version of Google Analytics. It will require some setup effort to get meaningful reports (as with any measurement tool) but it has the power to transform how you allocate budget across a range of online marketing platforms. But if this still is not working for you then you may have a problem with cross domain tracking. Need a bit more advice or have any questions? Get in touch with our experts or leave a comment below!   Get Social! Follow us on LinkedIn, Twitter, and Facebook and keep up-to-date with our Google Analytics insights.

2016-08-04

Why do you need cross-domain tracking?

What is cross-domain tracking and why do you need to implement in your Google Analytics account? Cross-domain tracking makes it possible for Analytics to see sessions on two related sites (such as an ecommerce site and a separate shopping cart site) as a single session. This is sometimes called site linking. Cross-domain literally means that you are able to see a user in a single Google Analytics account in his journey across multiple domains that you control (e.g. mysite.com and myshoppingcart.com). In the standard configuration of the Google Analytics script, every time a customer loads a page on a different domain a new session is generated, even if the branding looks seamless to the user and, unfortunately, the previous session has ended and this is even if the customer is still active and generates events and page views. Until you have implemented the cross-domain setting on your website you will not be able to have an accurate customer journey. Why? Let’s take, for example, a standard website, www.siteA.com, and it's blog, www.blogB.com. To track sessions, Analytics collects a client ID value in every hit. Client ID values are stored in 1st party cookies, and these cookies are only available to web pages on the same domain. When tracking sessions across multiple domains, the client ID value has to be transferred from one domain to the other. To do this, the Analytics tracking code has linking features that allow the source domain to place the client ID in the link URL, where the destination domain can access it. Fortunately, with the release of Universal Analytics cross-domain tracking, it is easier to implement, and especially so with Google Tag Manager. Setting up cross-domain tracking using Google Tag Manager Add (or edit your existing) a basic page tracking tag (i.e. Tag Type = Universal Analytics; Track Type = Page View). If you are using the same container for siteA.com and blogB.com, under More Settings → Fields to Set, enter the following: Field Name: allowLinker Value: true Under More settings → Cross-Domain Tracking → Auto Link Domains enter "blogB.com" (without the quotes). If you have multiple domains, separate them by commas: blogB.com, siteC.com Leave the 'Use hash as delimiter' and 'Decorate forms' unless you have an unusual web setup. Set the trigger to "All Pages". Save a version of the container and publish it. If you are using a separate container for blogB.com, repeat the steps above but in the Auto Link Domains field add: siteA.com Add both domains to the Referral Exclusion List When a user journey crosses from your first domain to your second domain, it will still appear as a new session in Google Analytics by default. If you want to be able to track a single session across multiple domains, you need to add your domains to the referral exclusion list. Here’s an example Tag Assistant Recordings report that shows what it looks like when cross-domain tracking is not setup properly. Setting up cross-domain tracking by directly modifying the tracking code To set up cross-domain tracking for multiple top-level domains, you need to modify the Google Analytics tracking code on each domain. You should have basic knowledge of HTML and JavaScript or work with a developer to set up cross-domain tracking. The examples in this article use the Universal Analytics tracking code snippet (analytics.js). Editing the tracking code for the primary domain ga('create', 'UA-XXXXXXX-Y', 'auto', {'allowLinker': true}); ga('require', 'linker'); ga('linker:autoLink', ['siteB.com'] ); Remember to replace the example tracking ID (UA-XXXXXX-Y) with your own tracking ID, and replace the example autoLink domain (siteB.com) with your own secondary domain name. Editing the tracking code on the secondary domain ga('create', 'UA-XXXXXXX-Y', 'auto', {'allowLinker': true}); ga('require', 'linker'); ga('linker:autoLink', ['siteA.com'] ); Remember to replace the example tracking ID (UA-XXXXXX-Y) with your own tracking ID, and replace the example autoLink domain (siteA.com) with your own primary domain name. Adding the domain to page URLs using filters By default, Google Analytics only includes the page path and page title in page reports - not the domains name. For example, you might see one page appear in the Site Content report like this: /contactUs.html Because the domain names aren’t listed, it might be hard to tell whether this is www.siteA.com/contactUs.html or www.blogB.com/contactUs.html. To get the domain names to appear in your reports you need to do two things: Create a copy of your reporting view that includes data from all your domains in it Add an advanced filter to that new view. The filter will tell Google Analytics to display domain names in your reports. Follow this example to set up a view filter that displays domain names in your reports when you have cross-domain tracking set up. For some fields, you need to select an item from the dropdown menu. For others, you need to input the characters here: Filter Type: Custom filter > Advanced Field A: Hostname Extract A: (.*) Field B: Request URI Extract: (.*) Output To: Request URI Constructor: $A1$B1 Click Save to create the filter. You can validate that filters are working as you expect using Google Tag Assistant Recordings. Tag Assistant Recordings can show you exactly how your filters change your traffic.   Get Social! Follow us on LinkedIn, Twitter, and Facebook and keep up-to-date with our Google Analytics insights.

2016-08-02

Get the app

See for yourself why Littledata is the smartest ecommerce analytics app

Free trial