Accurate tracking of time on site

There’s a flaw in the way Google Analytics measures ‘time on site’: the counter only starts from the second page visited, so all one-page visits are counted as zero time on site. If a visitor comes to your page, stays for 10 minutes reading – and then closes the window… that’s counted as ZERO time. With landing pages that have lots of interaction, or the call to action is a phone call rather than a click, this can be a real problem. Pasting the Javascript below onto all the pages of your site will fix the problem. The script logs an event to Google Analytics for every 10 seconds the visitor stays on the page, regardless of whether they bounced or not. But it won't affect your bounce rate or time on site for historical comparison *. We suggest you look closely at how visitors drop off after 10, 20 and 30 seconds to see which of your web content could be improved. Paste this into the source of your all your pages, after the Google Analytics script <!-- Time on Site tracking (c) LittleData.co.uk 2014 --><script>(function(e){var t=true;var n=0;var r=true;var i=function(){t=false};var s=function(){t=true};if(window.addEventListener){window.addEventListener("blur",i,true);window.addEventListener("focus",s,true)}else if(window.attachEvent){window.attachEvent("onblur",i);window.attachEvent("onfocus",s)}var o=function(e){return Math.floor(e/60)+":"+(e%60==0?"00":e%60)};var u=window.setInterval(function(){e=e+10;if(t){n=n+10;if(typeof _gaq==="object"){_gaq.push(["_trackEvent","Time","Log",o(n),n,r])}else if(typeof ga==="function"){ga("send",{hitType:"event",eventCategory:"Time",eventAction:"Log",eventLabel:o(n),eventValue:10,nonInteraction:"true"})}}},1e4);window.setTimeout(function(){clearInterval(u)},601e3)})(0)</script> What you'll see In Google Analytics go to Behaviour .. Events .. Top Events and click on the event category 'Time'.                               Searching for a particular time will find all the people who have stayed at least that length of time. e.g. 0:30 finds people who have stayed more than 30 seconds. FAQs Does this affect the way I compare bounce rate or time-on-site historically? No. The script sends the timer events as 'non-interactive' meaning they won't be counted in your other metrics. Without this, you would see a sharp drop in bounce rate and an increase in time on site, as every visitor was counted as 'non-bounce' after 10 seconds. If you prefer this, see below about adapting the script. Will this work for all browsers? Yes, the functions have been tested on all major, modern browser: IE 9+, Chrome, Safari and Firefox. What if I upgrade to Universal Analytics? Don’t worry – our script already checks which of the two tracking scripts you have (ga.js or analytics.js) and sends the appropriate log. Will this max out my Google Analytics limits? The script cuts off reporting after 5 minutes, so not to violate Google’s quota of 200 – 500 events that can be sent in one session Can I adapt this myself? Sure. The full source file is here. Need more help? Get in touch with our experts!

2016-11-13

How to set up ecommerce tracking with Google Tag Manager

Enhanced ecommerce tracking requires your developers to send lots of extra product and checkout information in a way that Google Analytics can understand. If you already use GTM to track pageviews you must send ecommerce data via Google Tag Manager Step 1 Enable enhanced ecommerce reporting in the Google Analytics view admin setting, under 'Ecommerce Settings' Step 2 Select names for your checkout steps (see point 4 below): Step 3 Get your developers to push the product data behind the scenes to the page 'dataLayer'. Here is the developer guide. Step 4 Make sure the following steps are tracked as a pageview or event, and for each step set up a Universal Analytics tracking tag: Product impressions (typically a category or listing page) Product detail view (the product page) Add to basket (more usually an event than a page) Checkout step 1 (views the checkout page) Checkout step 2 etc - whatever registration, shipping or tax steps you have Purchase confirmation Step 5 Edit each tag, and under 'More Settings' section, select the 'Enable enhanced ecommerce features' and then 'use data layer' options: Of course, there's often a bit of fiddling to get the data layer in the right format, and the ecommerce events fires at the right time, so please contact us if you need more help setting up the reports! Step 6 - Checking it is working There is no 'real time' ecommerce reporting yet, so you'll need to wait a day for events to process and then view the shopping behaviour and checkout behaviour reports. If you want to check the checkout options you'll need to set up a custom report: use 'checkout options' as the dimension and 'sessions' and 'transactions' as the metrics. Need some more help? Get in touch with our lovely team of experts and we'd be happy to answer any questions!   Get Social! Follow us on LinkedIn, Twitter, and Facebook and keep up-to-date with our Google Analytics insights.  

2016-11-10

Top 5 pitfalls in tracking ecommerce in Google Analytics

We all need our Google Analytics data to be correct and realistic. Ecommerce, just like any other website, needs correct data. What makes ecommerce websites more open to error is the ecommerce data capturing. We have put together a list of 5 mistakes in a Google Analytics integration that you should check before starting reporting on your online store! Top 5 pitfalls in tracking ecommerce in Google Analytics Tracking code is missing from some pages Multiple page views sent Multi- and subdomain tracking issues Wrong usage of UTM parameters Wrong usage of filters   Tracking code is missing from some pages The easy way for an established website to see if the tracking is complete is to go to Google Analytics > Acquisition > Referrals and search the report for the name of your website, as shown below. If you have a lot of pages and are not sure how to find which exact pages are missing the code, you can use the GA Checker.   Multiple page views sent The second most common issue we found is having multiple Google Analytics scripts on the same page. The easiest way to check this is with the Tag Assistant extension from chrome. Go on your website and inspect the page (see image below). You can also use the GA Checker for this. The solution is to leave only one script on the page. There are situations where you're sending data through Google Tag Manager. If you see 2 pageviews in Tag Assistant or gachecker.com, you should take a look at your tags. There should be only one for pageview tracking!   Multi- and Subdomain Tracking Issues Are you seeing sales attributed to your own website? Or your payment gateway? Then you have a cross-domain issue. And you can read all about it in our blog post: Why do you need cross-domain tracking?. You can see if this is the case by going to Acquisition > Overview > Source/Medium and find your domain name or payment provider.   Wrong usage of UTM parameters You should never tag your internal links with UTM parameters. If you do so every time a clients click's on a UTM tagged link, a new session and the original source will be overwritten. Pay attention to your campaign sources and search if something suspicious appears in the list. You'll find, you have internal links tagged when you will try to find the source of your transactions and find the name of the UTM parameters from your website instead. Read what UTM's are and why you should use them in our blog post: Why should you tag your campaigns?.   Wrong usage of filters Using filters will improve the accuracy of your data, however, data manipulated by your filters cannot be undone! To prevent your filter settings or experiments to permanently alter your traffic data you should set up separate views, and leave an unfiltered view with raw data just in case. Check your filters section and be sure you know each purpose. You can check more on this blog post: Your data is wrong from gravitatedesign.com. Need help with any of these common mistakes? Get in touch and we'd be happy to help!   Get Social! Follow us on LinkedIn, Twitter, and Facebook and keep up-to-date with our Google Analytics insights.

2016-11-01

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"] &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? 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 Image credit: Image courtesy of hub.3dissue.net

2016-09-22

Setting up common email software for Google Analytics

Many of the popular email providers make it easy to automatically tag up links in your emails to allow Google Analytics to track them under the 'Email' channel. Without this, the traffic from email links will be dispersed under 'Direct' and 'Referral' channels, and you won't be able to see which emails really drive engagement or sales. Here are the links to set up some common email services: MailChimp Campaign Monitor ActiveCampaign Benchmark Email ConstantContact iContact Emma MadMimi GetResponse Mail Jet If your email provider is not in the list, or you send emails from your own platform, you'll need to manually paste in tagged up email links. Still need some help? Contact us and we'll be happy to answer any questions!

2016-08-24

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

Get the Littledata analytics app

Complete picture of your ecommerce business. Free Google Analytics connection, audit and benchmarks.

Sign up