Widget Tracking with Google Analytics

I was asked recently about the best way to track a widget, loaded in an iframe, on a third-party site with Google Analytics. The difficulty is that many browsers now block 3rd party cookies (those set by a different domain to the one in the browser address bar) – and this applies to a Google Analytics cookie for widgets as much as to adverts. The best solution seems to be to use local storage on the browser (also called HTML5 Storage) to store a persistent identifier for Analytics and bypass the need to set a cookie – but then you have to manually create a clientID to send to Google Analytics. See the approach used by ShootItLive. However, as their comment on line 41 says, this is not a complete solution - because there are lots of browsers beyond Safari which block third party cookies. I would take the opposite approach and check if the browser supports local storage, and only revert to trying to set a cookie if it does not. Local storage is now possible on 90% of browsers in use and the browsers with worst 3rd party cookie support (Firefox and Safari) luckily have the longest support for local storage. As a final note, I would set up the tracking on a different Google Analytics property to your main site, so that pageviews of widgets are not confused with pageviews of your main site. To do list: Build a script to create a valid clientID for each new visitor Call ga('create) function, setting 'storage' : 'none', and getting the 'clientID' from local storage (or created from new) Send a pageview (or event) for every time the widget is loaded. Since the widget page is likely to be the same every time it is embedded, you might want to store the document referrer (the parent page URL) instead Need help with the details? Get in touch with our team of experts 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-25

It’s Black Sunday – not Black Friday

The biggest day for online retail sales among Littledata’s clients is the Sunday after Black Friday, followed closely by the last Sunday before Christmas. Which is more important - Black Friday or Cyber Monday? Cyber Monday saw the biggest year-on-year increase in daily sales, across 84 surveyed retailers from the UK and US. In fact, Cyber Monday is blurring into the Black Friday weekend phenomenon – as shoppers get used to discounts being available for longer. We predict that this trend will continue for 2016, with the number of sales days extending before and after Black Friday. Interested in what 2016 will bring? Stay tuned for our upcoming blog post! Want to see how you did against the benchmark? Sign up for a free trial or get in touch if you have any questions!   Get Social! Follow us on LinkedIn, Twitter, and Facebook and keep up-to-date with our Google Analytics insights.

2016-11-23

The Black Friday Weekend of 2015

Shoppers on Black Friday are becoming more selective – with a decrease in the number of retailers seeing an uplift in Black Friday sales, but an increase in the purchase volumes seen at those selected stores. Littledata looked at the traffic and online sales of 84 ecommerce websites* over the Black Friday weekend (four days from Friday to the following Monday), compared with the rest of the Christmas season (1st November to 31st December). 63% of the surveyed retailers saw a relative increase in traffic on Black Friday weekend 2015 versus the remainder of the season, compared with 75% of the same retailers seeing traffic rise on Black Friday 2014. This implies some decided to opt out of Black Friday discounting in 2015 or got less attention for their discounts as other retailers spent more on promotion. The same proportion of retailers (60% of those surveyed) also saw a doubling (on average) in ecommerce conversion rate** during Black Friday 2015. In 2014, over 75% of retailers saw an improved conversion rate during Black Friday, but the median improvement over the rest of the season was just 50%. 61% of websites also saw an increase in average order value of 16% during Black Friday 2015, compared with only 53% seeing order values increase the previous Black Friday. We predict that this trend will continue in 2016, with a smaller number of websites benefiting from Black Friday sales, but a greater increase in ecommerce conversion rate for a select few. Be sure to check back for what the actual trends will be for 2016! Let us know what you think below or get in touch! * The surveyed websites were a random sample from a group which got a majority of their traffic from the UK or the US. The data was collected from Google Analytics, and so represents real traffic and payments. ** The number of purchases divided by the total number of user sessions   Image credit: HotUKDeals   Get Social! Follow us on LinkedIn, Twitter, and Facebook and keep up-to-date with our Google Analytics insights.

2016-11-18

What are custom dimensions in Google Analytics?

By default, Google Analytics allows you to segment traffic by standard dimensions such as visitor location, screen size, or traffic source. You can view smarter reports by adding custom dimensions specific for your business. Give me an example Let's say when your members register they add a job title. Would you like to see reports on the site activity for a particular job title, or compare conversion for one job title versus another? In which case you would set a custom dimension of 'Job Title' and then be able to filter by just the 'Researchers' for any Google Analytics report. Or if you run a blog / content site, you could have a dimension of 'author' and see all the traffic and referrals that a particular author on your site gets. How do I set this up? First, you need to be on Universal Analytics, and then you need to tag each page with one or more custom dimensions for Google Analytics. This is more easily done with Google Tag Manager and a data layer. It may be that the information is already on the web page (like the author of this post), but in many cases, your developer will need to include it in the background in a way that can be posted to Google Analytics. Then you will need to set up a custom report to split a certain metric (like page views) by the custom dimension (e.g. author). Please contact our specialists if you want more advice on how to set up custom dimensions!   Get Social! Follow us on LinkedIn, Twitter, and Facebook and keep up-to-date with our Google Analytics insights.

2016-11-16

Exclude fake 'bot' traffic from your site with Google Analytics

Ever wondered why so few visitors convert on your site? One answer is that a big chunk of your traffic is from search engine spiders and other web 'bots' which have no interest in actually engaging with you. Google Analytics has a great new feature to exclude this bot traffic from your site. All you need to do is check a box under the Admin > View > View Settings. The new option is down the bottom, underneath currency selection. It uses the IAB /ABC Bots and Spiders list, which is standard for large publishers, and updated monthly. Warning: you will see a dip in traffic from the date you apply the setting. If you're looking for a more comprehensive method to exclude spam and ghost referrals, check out our how-to guide! Have some questions about this? Get in touch with our Google Analytics experts!   Get Social! Follow us on LinkedIn, Twitter, and Facebook and keep up-to-date with our Google Analytics insights.

2016-11-15

What are Enhanced Ecommerce reports?

In May 2014 Google Analytics introduced a new feature: Enhanced Ecommerce tracking. If you run an ecommerce operation, this gets you much more detailed feedback on your checkout process. What will I see? Shopping behaviour: how are people converting from browsers to purchasers? Checkout behaviour: at what stage of your checkout do buyers abandon the process Product performance: which products are driving your sales, and which have a high return rate Real campaign returns: see your real return on marketing investment including promotional discounts and returns How do I set this up? The bad news is it definitely requires an experienced software developer for the setup. The reports require lots of extra product and customer information to be sent to Google Analytics. You can read the full developer information on what you can track, or our own simpler guide for tracking ecommerce via Tag Manager. However, if you already have standard ecommerce tracking and Google Tag Manager, we can set Enhanced reports up in a couple of days with no code changes on your live site - so no business disruption or risk of lost sales. Is it worth implementing? Imagine you could identify a drop-off stage in your checkout process where you could get a 10% improvement in sales conversion or a group of customers who were unable to buy (maybe due to language or browser difficulties) – what would that be worth? Many businesses have that kind of barrier just waiting to be discovered…   Get Social! Follow us on LinkedIn, Twitter, and Facebook and keep up-to-date with our Google Analytics insights.

2016-11-14

How to track time on page with Google Tag Manager

Our script for accurate tracking of time on page beats Google's default measurement to give you an accurate picture of how long users are spending on your page open and in focus. This post translates the approach into Google Tag Manager. The setup consists of two tags (one custom), one firing rule and two variables. Step by step: 1. Add the timer script as a custom HTML tag <script><br /> /*<br /> Logs the time on the page to dataLayer every 10 seconds<br /> (c) LittleData consulting limited 2014<br /> */<br /> (function () {<br /> var inFocus = true;<br /> var intervalSeconds = 10; //10 seconds<br /> var interval = intervalSeconds * 1000;<br /> var eventCount = 0;<br /> var maxEvents = 60; //stops after 10 minutes in focus<br /> var fnBlur = function(){inFocus = false; };<br /> var fnFocus = function(){inFocus= true; };<br /> if (window.addEventListener) {<br /> window.addEventListener ('blur',fnBlur,true);<br /> window.addEventListener ('focus',fnFocus,true);<br /> }<br /> else if (window.attachEvent) {<br /> window.attachEvent ('onblur',fnBlur);<br /> window.attachEvent ('onfocus',fnFocus);<br /> }<br /> var formatMS = function(t){<br /> return Math.floor(t/60) +':'+ (t%60==0?'00':t%60);<br /> }<br /> var timeLog = window.setInterval(function () {<br /> if (inFocus){<br /> eventCount++;<br /> var secondsInFocus = Math.round(eventCount * intervalSeconds);<br /> dataLayer.push({"event": "LittleDataTimer", "interval": interval, "intervalSeconds": intervalSeconds, "timeInFocus": formatMS(secondsInFocus) });<br /> }<br /> if (eventCount>=maxEvents) clearInterval(timeLog);<br /> }, interval);<br /> })();<br /> </script> 2. Add two variables to access the data layer variables One for the formatted time, which will feed through the event label And one for the number of seconds in focus since the last event, which will feed through the event value 3. Add the firing rule for the event 4. Add the tag that reports the timer event to Google Analytics Options and further information You can change the timer interval in the custom HTML tag - the reporting will adjust accordingly. Choosing the interval is a trade-off between the resolution of the reporting and the load on the client in sending events, as well as Google's 500 hit per session quota. We've chosen ten seconds because we think the users who are in 'wrong place' and don't engage at all will leave in under ten seconds, anything more is some measure of success. If you'd like assistance implementing this or something else to get an accurate picture of how users interact with your site, get in touch!   Get Social! Follow us on LinkedIn, Twitter, and Facebook and keep up-to-date with our Google Analytics insights.

2016-11-14

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

Get the Littledata analytics app

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

Sign up