Category Archives: Analytics Set-up

Prospects vs Customers

Understanding your Website Visitors: Prospects vs Customers

A key metric for most websites is their conversion rate. It is a measure of how well their website is performing but, as it is an average, it can mask serious issues. People who already know you and your website (as they are existing customers) are much more likely to purchase during a single visit than people just discovering your website for the first time. But the data you use is for both groups combined.

L3 Analytics has developed an approach that identifies these two visitor segments (potentially with more granularity), allowing you to understand the behaviour of each. This is recorded in a custom dimension (which could be an Adobe eVar or similar in other tools) that records the type of visitor. Based on experiences with our clients, this can be used to expose some interesting behaviour. A website conversion rate might be 3.5% but only 0.4% for prospects, giving a very different picture on performance and your internal priorities.

How this Works

It is actually more difficult than it first seems to capture a Visitor Type. The most important lesson is that the Visitor Type MUST be set at the start of the session. This allows us to calculate the conversion rates for prospects vs customers. Otherwise only customers could place an order (as prospects become customers after doing so). But, on their next visit to the website, we need to know they are then a customer.

The exception is if the visitor logs in (having registered in a previous session) during the course of the session. After logging in, we know definitely what their Visitor Type was at the start of the session and the value should be updated to reflect this. It does mean this value needs to be passed through from internal systems.

Finally, we want to know if people are customers whether they are logged in or not. As a Visitor Type is not personally identifiable, we feel comfortable recording this after a visitor logs out.

The solution to all this is to use two cookies. One cookie is a short term cookie (equivalent to session-based) recording the value as at the start of the session (or after login). The other is a cookie with an expiration date in the distant future that records the actual Visitor Type as at that point in time. The short term cookie is the one recorded in your analytics tool.

How this Works in Practice

Creating the Cookies

The logic for defining the cookies for the simple use case where there are two Visitor Types only – prospects and customers – is as follows:

On every page load

  • If short cookie exists
    • Read current value
    • Write current value back out with 30 min expiration date
  • If short cookie doesn’t exist
    • If logged in
      • Identify visitor type (“prospect” or “customer”)
        • Set short cookie to visitor type with expiration of 30 min
        • Set long cookie to visitor type with expiration of 2 years
    • If not logged in
      • If long cookie exists
        • Set short cookie to value of long cookie with expiration of 30 min
      • Otherwise
        • Set short cookie to “prospect” with expiration of 30 min
        • Set long cookie to “prospect” with expiration of 2 years

On Login (not on registration)

  • Identify visitor type (“prospect” or “customer”)
    • Set short cookie to visitor type with expiration of 30 min
    • Set long cookie to visitor type with expiration of 2 years

On Purchase

  • If long cookie set to “prospect”
    • Set long cookie to “customer” with expiration of 2 years

Note the cookie needs to be set as “path global” so it can be read across the entire website. They should be set as first party cookies.

Capturing Visitor Type using Google Tag Manager

The following logic can be used with any Tag Management System, but the examples provided are for GTM.  The first step is to create a variable for each of the two cookies. These are very straightforward, simply grabbing the value from the two first party cookies.

session cookie variable

Then another variable needs to be created to record the Visitor Type to be used within the analytics tag. (The JavaScript required for this was provided by someone else, potentially Simo. If I remembered for sure, I would give due credit for this, apologies for not doing so.) The key reason for using this approach instead of just using the value within the short cookie is that, based on experience, the cookies have not always been created before the page tag fires and therefore we need to have a fall back option.

code for visitor type

The final step is to use this latest GTM variable within your GA tags to populate a Custom Dimension. Don’t forget to define this Custom Dimension within your Google Analytics configuration as well (or other tools). As the value for this custom dimension can change from session to session, the scope should be set at session level.

The Caveats for Visitor Type data

The first caveat is that this data will not be, and could never be, 100% accurate. For visitors who are not logged in, it is just not possible to know definitely whether they are an existing customer or a prospect.

The accuracy will improve over time as customers return and can be identified as such even if not logged in. However, this does not work if they delete their cookie or use a different device.

These is also a skew towards customers for purchases. To explain that, imagine two unidentified visitors entering the website, although both are actually customers. As such, they are identified as “prospect”. They both do some research while not logged in. One then exits the website while the other decides to purchase the products they found. During the checkout process, this visitor logs in and is identified as a “customer” with their behaviour during the entire session recorded as for a customer.

The results will show a 0% conversion rate for prospects and a 100% conversion rate for customers. Reality is a 50% conversion rate for customers. Again, nothing can be done here except being aware of this skew in the data.

Extending the List of Visitor Types

This really depends on your business and how you will use the information. For some businesses, there is a stage in between prospect and customer of “registered” (visitors who are in your email database but have not yet purchased). You could split prospects by New & Returning. Or better, by some sorts of segment like New, Aware, Research, Interested based on session scoring. For customers, there are so many segments or personas that could be applied, taking this information directly from the back end database e.g. loyal customers, discount shoppers, inactive customers, family shopper, etc.

Using the Visitor Type Information

With the tracking in place, it is then just a matter of analysing the data. If using Google Analytics, you can create a segment for each Visitor Type (so you can apply to all reports), create a Custom Report with Visitor Type as the first dimension (comparing performance side by side for selected metrics) or apply as a secondary dimension to many reports (for ad hoc analysis).

As noted at the start of this blog post, the obvious metric to look at is Conversion Rate. Beyond that, all the engagement metrics should demonstrate clear differences in behaviour. There are likely differences in the traffic sources used by prospects and customers (discovering website vs already being aware of it), the entry points into the website and the content being viewed.

An interesting one is looking at marketing costs and seeing just how much is spent on existing customers. This will allow a more accurate Cost of Acquisition to be calculated, taking into account only new customers, and only the marketing spend for prospects.

So, have I convinced you of the value of this piece of information? I find it provides the clearest and most valuable segmentation into performance, especially when it comes to driving actions. Of course, while full details have been provided on how to set up Visitor Type tracking, we would be happy to help out any companies who would like our assistance in doing so – please contact us on or +44 (0)20 8004 0835.


A Powerful Use Case for GA Calculated Metrics

By now everyone should be excited about the release of Calculated Metrics within Google Analytics. This has the potential to be yet another powerful tool for analysis, although it will only prove useful to companies who are investing the time and resources in a good GA set-up. As a bonus, it shuts down another line in the arguments between Google & Adobe Analytics.

Details on how to create Calculated Metrics can be found in some great blog posts, notably those by LunaMetrics and AnalyticsPros, including a solid list of suggestions to get you started. It is a staggered roll out of the new feature so don’t be alarmed if you don’t have access yet, it shouldn’t be far away from appearing in your GA Account.

But I was confused by these and other blog posts as they appeared to be missing the most obvious and powerful use of Calculated Metrics. Most businesses have some form of funnel at the core of their website. In nearly every GA set-up that L3 Analytics performs, we create a goal for each stage of this process. Our clients can then create a horizontal funnel, with this being an incredibly useful tool for analysing performance.

With Calculated Metrics, you can now create the completion rate between each stage of the funnel. It is as simple as Goal Y Completions / Goal X Completions. This set of calculated metrics can then be used with any session or user based dimension to see where visitors are dropping out of the process. We have been doing this within Excel for years and it is great to finally be able to do it directly within GA. It will speed up the analysis process immensely and offer more flexibility in which dimensions to drill into.

Step by Step Instructions

Step 1 – Create a Goal for each stage of the funnel

As mentioned, most websites have a funnel as the core component of their customer journey. It is obvious for any ecommerce website but also true for booking engines and lead generation websites. As a first step, identify each stage in the funnel, ensure it is being tracked and create a Goal based on the page name or event being fired.

The following set of goals reflects the funnel for a retail website (where the visitor is not taken directly to the basket after creating it). Note that an Ecommerce Session is one where a visitor is interested in a purchase.

Calculated Metrics - Goal List

Step 2 – Create the Calculated Metrics

The next step is to create a Calculated Metric for the completion rate between each stage of the process. This uses Goal Completions. So the calculations are:

  • {{View Product (Goal 2 Completions)}} / {{Ecommerce Session (Goal 1 Completions)}}
  • {{Create Basket (Goal 3 Completions)}} / {{View Product (Goal 2 Completions)}}
  • {{View Basket (Goal 4 Completions)}} / {{Create Basket (Goal 3 Completions)}}
  • And so on…

Calculated Metrics CreationThe formatting type needs to be percent as per above. I discovered that as long as you are creating good Calculated Metric names, the external names will take care of themselves.

Calculated Metrics List

Step 3 – Use these Calculated Metrics within Custom Reports

All of these Calculated Metrics can then be used within a custom report. In this example, we will be creating a Funnel metric group. Start the sequence with “Sessions” and “Goal X Conversion Rate” to show total traffic and % of sessions that progress to stage 1 of the funnel. Then list the calculated metrics for completing each stage of the funnel process, finishing with the number of total conversions.

Calculated Metrics - Custom Report Set-up

Multiple Metric Groups could be used in these custom reports, for traffic metrics, the funnel, ecommerce metrics, etc. However the powerful thing here is the range of dimensions to choose from. Common options would include:

  • Device Category
  • Channel
  • Browser
  • Country
  • User Type

If you are capturing Visitor Type (prospect vs customer) in a custom dimension and/or Page Type in a Content Group (use Landing Page group to get Entry Points), this all gets more amazing.

Below is what you get as an output: a simple breakdown by stage of the funnel for whatever dimension/s you have selected. As a custom report, you would be creating it so you can drill down through dimensions to make it even more useful.

Calculated Metrics - Custom Report Output

Knowing that your Conversion Rate is lower for segment X vs segment Y is not that valuable. Knowing that two dimension values behave exactly the same except for one stage in the funnel pinpoints where you have to take action.

Additional Points, Notes and Caveats

It must be noted that this technique works on the assumption that visitors must progress through each stage of the funnel. We know that this is not the case, especially when, for the above example, visitors could be entering the website with a persistent basket or creating a cart without viewing a product page. It is the job of the analyst to take these factors into account with any recommendations they make.

Further note that this is all session based analysis, as it is using Goals. For many businesses, visitors will take multiple sessions to convert. This approach is still useful though, in terms of seeing how far through the funnel the visitors proceed each time.

The overall technique is similar to an approach suggested by LunaMetrics back in June 2010. Their suggestion was to create a series of two step GA funnels for each stage of the website funnel and use Goal Abandonments for reporting. It would produce a similar report, although I prefer completion rates. It also means each stage needs to be based on pages, whereas this approach means you can use goals created from events.

Funnels do not have to be complex journeys. If you have a Contact Form on your website, it is more useful to know the number of form completions than to know the % sessions in which the form was submitted. This requires a goal for View Contact Form, a goal for Submit Contact Form, and a Calculated Metric for the completion rate.

Finally, we are looking into other Calculated Metrics as well. There is a list for content websites to calculate: Read Rate, Share Rate, Entry Rate, Engagement Score, etc. Watch this space for more ideas in the future…

89AZTB8E5H (1) (1)

Generating Custom Dimensions from Page Names

Custom Dimensions

I discovered a few months back that you can use Custom Dimensions within Google Analytics filters. This was great as it allowed us to created segmented Views based on session/user level custom dimensions (created using GTM via a Data Layer) for segments like Subscriber Traffic, Free Traffic, Desktop website and Mobile website.

But I had an idea in the back of my mind and finally found an excuse to test it out a couple of weeks ago.

We have a client that we are working with to implement enhanced Google Analytics tracking. Like most organisations, there is a development cycle and the new Data Layer is scheduled to be worked on in a couple of months’ time (ideally it is worked on sooner but we have experienced far longer waits as well). So we were looking for quick wins in the meantime.

Reviewing page names, their core page is a product details page. And the URL includes an ID, a code for the previous page and even the index for the location of this product within the product list on that previous page. All great information but excessive for these page names (they were actually breaking the GA table limit).

Back to my idea. Could we use GA View Filters to create hit level custom dimensions? This client is still on classic GA so can’t create custom dimensions via the code. Only one way to find out…

The current page name uses the structure below. It is not the sort of URL I would construct for SEO purposes but happy to take it for analytics as it was about to become very useful.

/product-<product id>/<source index>/<source description>
e.g. /product-456827/5/hpg

The first step is to create the Custom Dimensions within the Google Analytics configuration. Just enter the name you want to use and leave the scope as Hit (as per the screenshot at the top of this post)

Then you will discover that these custom dimensions appear in the list of dimensions that can be used within the GA View Filters. They are right at the bottom of the list.

Selecting Custom Dimensions in View Filter

To populate these new custom dimensions, you need to create three View Filters. As always, use a good naming convention so it is easy to identify the purpose of the filter. The filter type we need is a Custom Advanced filter.

With this example, Field A needs to be the Request URI (which is the page name). I used a regular expression to identify the page naming convention that I need. A key point in this is to enclose any element that you wish GA to remember within brackets. All three key elements are wrapped in brackets for this example.


Then set the Output Field to the desired custom dimension and populate it with the element extracted from the page name. In this example, we have used $A1 e.g. the first element in brackets within Field A. The other two custom dimensions will need to use $A2 and $A3.

Populating a Custom Dimension using View Filter

Checking the data a day later showed success. The custom dimensions are populated with the product ID, access method and access index values. Through another filter, we even renamed all the product pages to /product-page, bringing the number of unique page names within GA table limits without losing any data.

With custom reports or secondary dimensions, we can now review performance of these pages in more detail than previously possible. All without any need for dev involvement or even the use of Google Tag Manager (and I know you could do all this via GTM but this was easier still). Long term we will do this properly via the Data Layer but short term, a big win with a small amount of work.

So what about you, do you have any nuggets of information hidden within URLs/page names that could be extracted into Custom Dimensions?

google-analytics new features

2 Unusual Content Groups

We’ve been spoiled with all Google Analytics (GA) features released this year. At L3, we’re particularly keen on Content Grouping. After playing around with this toy for a while, I’d like to share a small tip about it.

As a reminder, the aim of this feature is to categorise your content. It’s incredibly useful and I recommend everyone to set up their content grouping (see this guide from Justin Cutroni for more information).

It is an unsaid thing but we can also take advantage of this to capture additional information – whether it aims to categorise your content or not. For instance, there are two content groups we find so useful we tend to implement them to all clients: the URL being viewed and the referrer of the current page.

Why should I capture this information?

The first reason is that it’s stupidly easy to set up with a Tag Management system (TMS) as Google Tag Manager (GMT):


Then, it can literately save your hide to identify unknown tracking issues. For instance, if you are smart enough to improve your page naming convention, it can be used to check which URLs are being viewed for each page.

Hence, even if you rename pages, you can still easily access the URL of the page. You just need go to your page report, click on the page to check and apply a secondary dimension:


Likewise, you can use the URL Landing Content Group to check which query parameters were on your destination URLs. I particularly like this report because I can quickly spot if there is anything wrong in the campaign tracking.

For this, you can simply go to your landing page report, change the primary dimension and use the search box to filter all pages containing a question mark:landing-url-content-grouping

The referrer content group allows us to see which URLs were viewed before a specific page. For instance, it can be very handy to analyse which URLs lead to a 404 page:


Why capturing this information as a content group?

People may wonder why I don’t use 1 of the 20 available custom dimensions to capture this information instead…

The key reason is that I find more handy to have this set up as a Content Grouping. For instance, it can be used as a Primary dimension in the ‘All Pages’ and ‘Landing Pages’ reports whereas custom dimensions are only available as a Secondary Dimension:


Then, I can use a secondary dimension to check the previous, next or entry URL :


(note that I can also use the ‘Navigation Summary’ report as the URL level with this content grouping)

Following that, I prefer using Content Grouping to capture some information available across all pages of a website. For instance, the author name or the product category can only be captured on specific pages – I’d rather use here a custom dimension to avoid seeing ‘(not set)’ in my content group reports.  

In the end, I record most of the page-level information I need as custom dimensions. Hence, the 5 available Content Grouping slots are more than enough for me and I’m happy to add those 2 unusual content groups to make my life easier.

What about you?

What do you think about those two content groups? Would you be willing to give away 2 slots to capture this?

Please feel free to agree/disagree using comments – I would love to know if other analysts have other tips to share regarding Content Grouping.


Accurate Sessions by Traffic Source

Possibly the most annoying piece of “business logic” within Google Analytics (in my opinion) is that Direct Entry sessions are attributed back to the original traffic source.  I want to know what is really happening!!  I want to know if people are really coming from organic search, emails, affiliates, etc or if they are using remembered URLs, bookmarks, typing directly into the address bar.  But the acquisition reports in Google Analytics don’t tell us that.

Yes, I know the alleged reasons as to why this business logic is in place.  To give Google as much credit as possible for paid search marketing (and a better ROI on spend).  And this might be true.  The claimed reason – that people should be looking at the channel that caused the session to occur – is just as valid in a sense (although a bit flaky).  Let’s ignore that discussion and get into the data.

And yes, the last click method for claiming credit for sales/leads/conversions is bad (don’t get me started on attribution) but I am not going into that now, I just want to know the split by traffic source for sessions.

I thought of a trick one day…

And it’s a really simple one too…

Create a destination goal where the page matches via regex with /.  This should be triggered by every single visit.  And as goals can only be triggered once per visit, the number of goal completions will match the number of sessions (with a very very small level of difference).

Goal setup for all sessions goal

Then select the Conversions => Multi-Channel Funnels => Assisted Conversions report.  Change the Conversion Type so the report is only for the “All Sessions” goal (obviously this won’t work until data has collected for this goal).  The metric of “Last Click or Direct Conversions” now equates to sessions for each MCF Channel Grouping or Source/Medium or Source or Medium or any of the other dimensions (and secondary dimensions) you can select.

Question answered…

The trick here (in case you weren’t aware) is that the Multi-channel reports use the true traffic source, they don’t revert Direct Entry sessions to the previous traffic source.  Sessions is not an available metric by default but we just changed that.

Read the Google Analytics documentation under “How Direct Traffic is Treated” to confirm the way in which direct traffic is treated within the normal acquisition reports and the multi-channel funnel reports.



An alternative approach to GTM event tracking

Google Tag Manager feels like it has been around forever and we are now at the stage where I (& many other consultants) will refuse to do a Google Analytics implementation without it (or an equivalent TMS).  But it is still very new, features are evolving and best practices are still being invented.  With that in mind, I wanted to share the approach we use here at L3 Analytics for tracking events in Google Analytics.

I have to say first that we don’t have the developer background or skill-set of many other GTM experts – Phil, Carmen, Doug & of course Simo to name just a few.  As a result, I feel our approach has evolved differently, although we may now use similar ideas.

We aim to create minimal if any custom code within Google Tag Manager.  Instead we insist on our clients creating a Data Layer (on page load and for all visitor interactions) and using that to populate all the GA tracking via GTM.  There are exceptions and I will cover all that another time along with the reasons for this approach. But I want to focus here on event tracking with the information triggered by pushes to the data layer, not via the auto event tracking features in GTM.

The Current Approach

The current approach appears to be to use a naming convention for the variables pushed to the data layer of event, eventAction, eventLabel & eventValue.  Examples below can be found from Phil’s Guide to GTM and from one of the many great blog posts from LunaMetrics.

Code sample via Phil Pearce
Code sample via Lunametrics


The benefit of this approach is that you then only need one set of macros and a single tag for all your event tracking in Google Tag Manager.  Life is easy, job is done and even better, no work is required within GTM for new event tracking – just use the same naming convention.

Event category macro
Event Action macro


Event tag in GTM

However I don’t like this approach, it doesn’t feel right.  What is the point of a tag management tool if it doesn’t do anything except transfer information through to the analytics tool?  You can get the same result by adjusting the code slightly and sending the data directly to GA.

Then what if you want to change anything?  You need to change the code on the website.  This is fine for GTM users with a developer background but not so much for me.  It means all the logic is defined within the website tracking and I want to get away from relying on developers to get business logic right.

Event Tracking in GTM, the L3 Analytics way

So I have taken a different approach.  I wanted to still have a minimal amount of work to add new event tracking but for all the logic to be defined within GTM.  All I wanted from the developers who created the code & the data layer was information about the visitor interaction that occurred.

My approach is to simply record in the data layer all the information about the visitor interaction that occurred.  Obviously the name of the interaction is required but after that, it depends on what the interaction was.  The name alone may tell me everything I need to know or there might be two, three or ten more items of information to be sent through as well.  Great – send them through, I can decide if I want to use them or not.  And how.  And where.

The format of the data layer push is

‘event’: ‘visitor interaction’,
‘interactionName’: ‘<name of visitor interaction>’,
‘<variableName1>’: ‘<variable value 1>’,
‘<variableNameN>’: ‘<variable value N>’

To see that in practice, here are examples of what the push to the data layer would look like for five different visitor interactions.

Click on homepage widget

‘event’: ‘visitor interaction’,
‘interactionName’: ‘homepage widget’,
‘hpWidgetType’: ‘<widget type>’,
‘hpWidgetName’: ‘<widget name>’

Apply a filter on a product list page

‘event’: ‘visitor interaction’,
‘interactionName’: ‘product page filter’,
‘filterType’: ‘<type of filter>’,
‘filterValue’: ‘<value of filter>’,
‘numFiltersApplied’: ‘<number of filters previously applied>’

Track completion of a form field

‘event’: ‘visitor interaction’,
‘interactionName’: ‘form field tracking’,
‘fieldFormName’: ‘<name of form>’,
‘fieldFieldName’: ‘<name of field completed>’

Submission of a form

‘event’: ‘visitor interaction’,
‘interactionName’: ‘form submission’,
‘submitFormName’: ‘<name of form>’


Scrolling to the bottom of a content page

‘event’: ‘visitor interaction’,
‘interactionName’: ‘content read scroll’

That is a few examples, you will see why in a minute.  First task though is to create a macro for each and every variable you are now recording.  This is more work than for the commonly used approach, I admit that.  Takes about 30 seconds per variable though so not much more work.

Homepage widget name macro
Interaction name macro


Now comes the really clever part.  You use Macro Lookup Tables to define all your event tracking logic.  Easier to show you than to explain, look at the macros below defining the event category, action and label for my five examples.  The logic is based on the interaction name variable and the values used can be hard coded or use another item of information that was pushed to the data layer with that visitor interaction.

Event Category lookup table macro

Event action lookup table macro Event label lookup table macro

If there is no Event Label (or Event Value) for a particular visitor interaction, that visitor interaction is not included within the lookup table.

Now, guess what your event tracking tag looks like?  Is this at all familiar?  In case you hadn’t guessed, the rule will be {{event}} equals “visitor interaction”.

Event tag in GTM

So, besides an easy setup, let’s see what the other key benefit of this approach is.  Imagine you want to adjust the event tracking on form submissions so the event category field records “form submission” and the event action field records the name of the form (no event label field required).  With the normal approach, you either need to create a new tag just for this event or have the code changed.  With this approach, it takes less than a minute to adjust the necessary macro look up tables.

The analyst has control over all of the event tracking logic.  It still uses a minimal number of tags and rules, just with a lot more (very simple) macros and three or four lookup tables.  It is a very scalable solution and simple enough for non analysts to learn & be able to modify.  And beyond all of that, it feels like a very elegant solution, using a TMS as it is meant to be used…

What do you think?

L3 Analytics is recruiting.  Please contact us if you want to be part of a team coming up with these sorts of ideas.


Tracking clicks within iframes with Google Analytics and jQuery

A few days ago, I needed to implement Google Analytics click events within iframes. I was aware that “iframe tracking” often rhymes with “pain in the backside” but actually a few solutions do exist. One of my best finds was this great post from Doug Hall (Conversion Works):

It explains clearly why tracking iframe contents can be challenging. Social media buttons are a good example because most of them are pushed from a 3rd party domain. Two solutions are provided at the end:

  1. Using social sharing plugins like shareThis
  2. Using custom jQuery scripts like Goldon’s iframeTracker plugin

I tried the second one and I thought it could be interesting to share how to play around with this jQuery script using Google Tag Manager and Universal Analytics.

As a reminder, all credit from this post can be attributed to Doug Hall and Goldon – I have just applied here their recommendation.

The problem with tracking iframe contents

Let’s imagine I wanted to trigger Google Analytics events when visitors click on the following social media buttons:

(for information this is not a plugin, all buttons have manually been implemented, I’ve just used the standard source provided by each social media platform)

My first thought would be: “easy-peasy, a bit of jQuery within Google Tag Manager and it should work!”:


In reality, it’s a bit more intricate. If we try clicking on the above buttons and look at the result with a HTTP Header reader like HttpFox or Charles, we will notice that it works fine for Pinterest and LinkedIn but it doesn’t for the other ones (which are embedded through iframes):

All right, click tracking doesn’t work on the first three buttons because of lovely iframes but are we giving up? I’d rather “be more dog” like the last O2 TV ad and jump to grab the stick by trying other solutions like Goldon’s jQuery Plugin.

Using the jQuery Plugin iframeTracker

Instructions and technical details for this plugin can be found on GitHub. Basically, we just need to follow two steps to track clicks within iframes with Google Tag Manager and Universal Analytics:

1- Adding a first tag to enable the plugin

We create a first tag containing the source of the file jquery.iframetracker.js between <script></script> and we select a rule to fire this script only on pages containing the iframes we want to track:

2- Adding a second tag to enable the tracking

Then, to track clicks, we need to deploy another script with a jQuery selector calling the plugin. Here is the structure to use (more options are available on GitHub):


Let’s try to apply this on the previous example. You’ll find just below the same exact buttons, the only change is that I have added the class “iframetrack” on Twitter, Facebook and Google+ to select iframes I wanted to track more easily:

Here is for information the second tag I have set up within my Google Tag Manager container to enable the tracking:


If we now try to click on the below buttons and look at the information sent to Google Analytics, we will notice that this time all 5 social buttons are tracked:


It’s great to see that there are ways to track clicks within iframes. This solution might not be 100% perfect, I haven’t yet tried this plugin on many browsers but it looks to work fine on Firefox and Chrome. It implies using jQuery but it can be helpful to track clicks on elements embedded through iframes such as social buttons, video players, ads, etc.

Now your turn, what do you think about this plugin? Have you already tried it? Would you recommend other solutions to track interactions within iframes?

Tracking Errors with Web Analytics

I have developed an approach to tracking form validation and 404 page not found errors that I now use with all clients. The insights derived have been used to fix issues with their websites, positively impacting on their bottom line. The instructions below are for Google Analytics but the same approach can be used with any web Analytics tool.

Within GA, this approach requires the use of five page level custom variables. Yes, there are only five custom variable slots available total (soon to be more). But I said five variables, not five slots. Form pages and 404 error pages are two different page types and therefore we can reuse the custom variable slots. In fact, I generally use three slots for all of my page level custom variables.

Validation Errors

The first set of custom variables need to be set on pages where a form validation error has occurred. There are three pieces of information to be captured (so three slots):

  • the name of the form
  • the name of the first field that triggered a validation error
  • the error message for this field

Only the name of the first field that triggers a validation error needs to be captured as it is not realistic to capture everything, the first field will be sufficient.

The naming convention for these validation error custom variables is thus:

GA custom variables for Form Validation errors

The GA code on the page if you fail validation on a payment details page due to the customer entering a card number with spaces (form should be fixed to accept this) is:

_gaq.push([‘_setCustomVar’, 1, ‘form error – form’, ‘payment details’, 3]); _gaq.push([‘_setCustomVar’, 2, ‘form error – field’, ‘card number’, 3]); _gaq.push([‘_setCustomVar’, 3, ‘form error – message’, ‘Invalid card number, spaces not allowed’, 3]); _gaq.push([‘_trackPageview’]);

Your developers will need to add code to capture the form name, field name and error message. Note as well that the maximum length of each custom variable name and value combination is 128 characters so the error message may need to be truncated.

404 Page Not Found Errors

The code for 404 error pages is similar with only two pieces of information to be captured:

  • URL of the page
  • referrer to the page

Note that I recommend using the same page name for all 404 error pages as it makes identifying and understanding the scale and impact of these pages much easier.  A page name can be as simple as /error-page.

The naming convention for these custom variables is:

GA custom variables for 404 Page Not Found errors

The code on a misspelled page for the L3 Analytics Set-up service that is accessed via a YouTube page would be:

_gaq.push([‘_setCustomVar’, 1, ‘404 error – url’, ‘/services/web-analytics-setup/’, 3]); _gaq.push([‘_setCustomVar’, 2, ‘404 error – referrer’, ‘’, 3]); _gaq.push([‘_trackPageview’, /error-page]);

Accessing the Insights

So the data is being collected but how does it become actionable? DO NOT use the standard custom variable reports, they are not accurate/useful for page level custom variables. Instead create custom reports, one for each business question you wish to answer.

Each custom report should use the metrics of unique events (this equates to visits) and pageviews. The dimensions should be custom variable value 1, custom variable value 2 and, for the Form Validation Errors report, custom variable value 3. On the 404 Page Not Found Error report, create a second report tab with the two dimensions reversed.

Configuration for a Google Analytics Form Validation Custom Report

The key point is to create a filter for each report. This filter is based on the dimension custom variable key 1 matching “form error – form” or “404 error – URL”.  To make even easier, I have already created these custom report for you, simply copy these URLs to the address bar while in the appropriate Google Analytics account.

Identifying Actions to Take

On the Validation errors report, you will see a list of forms with the number of validation errors triggered for that form. Click on a form and you will see that fields that triggered the errors, again ranked based on number of errors. Finally click on a field name to see what the actual validation errors are. That’s actionable information!!

It is a similar story for the 404 error page report. You can see the top urls or top referrers creating these errors. In either case, you can click through for more information to help you narrow down the cause of the errors. Now go fix the links or set up some redirects.

So what do you think? Can you suggest any other ways this approach can be used? Please share the story in the comments if these reports help you to fix any problems.

Using the Google Analytics Tax field for Transaction Type

Figure carrying Tax word

I haven’t written a blog post for a while, some might call that lax but I will claim to having been too busy.  You might not have missed me or these posts in your inbox but I missed writing and sharing information.  In good news I have been busy with clients + setting up a second company to be launched soon + helping to organise the first UK Digital Analytics Unconference (MeasureCamp).  More details on MeasureCamp and my new company to be released soon.

An online retail client of mine needed to record the type of transactions being placed on their website (they use Google Analytics).  They sell prescription glasses and sunglasses online but customers can also choose to Try at Home first, take advantage of a Two for One offer to get new lenses for their existing glasses.  Recording the type of transaction (using a hierarchy for multiple types within the one purchase) is necessary for understanding the sales performance for each day.

My typical solution for a transaction category is to use the Affiliation field, but that was already taken to record the level of discount from promotional codes.  An alternative is a page level custom variable on the order confirmation page but that didn’t feel ideal.  So were there any other options?

I realised the only unused transaction field was Tax (apart from the geographical fields which are currently fairly pointless).  My client wasn’t using it to record the tax from transactions and there would be no requirement to do so in the future – an accurate tax bill could only come from back end systems.  As Tax is a numerical field, I have never thought of using it to record the name of a transaction type – but could I use a code instead?

An issue is that values in the Tax field are summed up over multiple transactions.  But as I intend to use the field to filter transactions, this will not cause any problems.  So the approach will work if a code is used to represent each type of transaction e.g. 1 = Two for One, 2 = Try at Home.  In fact, the first digit can represent the type of transaction and the second digit can represent the number of glasses purchased during within the transaction (unlikely to be more than 9 for any single purchase).

As mentioned, a hierarchy needs to be applied as only one transaction type can be recorded for each transaction.  So if two glasses are purchased through a Two for One deal and a reglaze is purchased within the same transaction, then the transaction is recorded as a Two for One as it is higher in the hierarchy.

For examples:

  • Tax = 14, four glasses purchased as part of a Designer Two for One offer
  • Tax = 41, one pair of non designer glasses purchased
  • Tax = 70, Try at Home box ordered with no glasses purchased

So to count the number of Designer Two for One transactions, simply filter transactions for Tax > 10 and < 20.  Or for Reglaze transactions, filter transactions for Tax > 50 and less than 60.

This is not ideal, it would be great if Google gave us some more descriptive variables for transactions (and other areas).  But an important aspect of Google Analytics is making use of the variables available to you to get at the intelligence you need.  And I think this approach is a valuable way of extracting useful intelligence – what do you think?

Adobe SiteCatalyst

Tracking Marketing Campaigns in SiteCatalyst

My opening line in a recent post needs to be repeated here – “in order to optimise spend and time invested in marketing activity, all traffic that a company has some control over should be identified within their web analytics tool”.  That post was regarding Google Analytics but the exact same principle applies to Adobe (Omniture) SiteCatalyst.

It is simpler with SiteCatalyst to track marketing links, you only need to add a single URL query parameter to the landing page URL.  And the web analytics tool offers the potential to be much more powerful, particularly through the level of granularity that can be captured.  But with more complexity comes greater requirements for setting up and maintaining the tracking of marketing channels.

I have created a SiteCatalyst Campaign URL Builder using Excel to make all this a lot easier.  It is:

  • a useful guide to the required configuration of SiteCatalyst for tracking campaigns
  • a tool for generating landing page URLs that contain the SiteCatalyst campaign parameter
  • a tool for generating campaign data to be uploaded into SiteCatalyst via SAINT
  • a means to implementing a process that allows for marketing campaigns to be tracked and performance analysed in detail

The tool is freely available for download here in either Excel 2007 or Excel 97-2003 versions.  A full set of instructions on using this tool are included within the Excel file.  Macros will need to be enabled for the SiteCatalyst Campaign URL Builder to work.

I do request that if you use the tool, that you do not remove my my logo crediting L3 Analytics with the creation of this Excel tool and that you spread the word via a tweet or other social media.

The remainder of this blog post supports the SiteCatalyst Campaign URL Builder through describing the various steps required in tracking marketing campaign using Marketing Channels in SiteCatalyst.  I do intend to extend this further in the future with detailed instructions on the configuration of Marketing Channels and SAINT classifications.

Identifying all Channels

Through painful experience, I have discovered that your first step needs to be to identify and list out all marketing channels for your organisation.  This forms the initial stage of the planning process.  The investment in time now will eliminate the need to return and add additional fields and channels that were missed initially.

The obvious marketing channels to identify include email, display, affiliates, social media and paid search.  This needs to be extended to cover all links that you have some control over such as operational emails (thank you for purchasing/registering), social media sharing buttons, offline marketing (via QR codes or vanity URLs) and links on corporate or micro websites.

Defining Channel Parameters

Now that you have a list of channels, you need to detail out the various parameters that can be associated with each channel.  This is equivalent to the additional campaign parameters available in Google Analytics but without the limitation of only three to four parameters.  Some potential lists of channel parameters are:

List of potential field per channel

This table is required for the set up of the SiteCatalyst Campaign URL Builder, defining the channels it will contain along with the list of fields for each channel.  The structure I recommend and used within the tool is to include two common parameters for all channels.  These do not have to be populated for all channels but allow for cross channel analysis of performance and saves on space.  Note that additional channels can be added later.

Adding campaign codes

Each link then needs to have a SiteCatalyst campaign URL query parameter added to the landing page URL.  The common default for this parameter is cid but you can choose your own.  This campaign parameter is populated with a tracking code consisting of a prefix relating to the marketing channel and then a unique identifier for each link tracked for that channel.

As an example, the landing page URL for the L3 Analytics homepage for a link from an email (using the prefix of eml) would be  The SiteCatalyst Campaign URL Builder is an easy way to generate these URLs containing the required campaign parameter.

For some channels, this will be a one off task to generate and insert the new URLs containing the SiteCatalyst campaign parameter.  For other channels, it will be an ongoing task with new URLs required for each new campaign.  Either way, this is simply the investment in resources required to understand and improve your marketing performance.

Note that the campaign parameter can be included as part of a redirect if it is not practical to have 3rd parties change the links on their websites.  This is the approach to be used for adding campaign tracking to offline marketing via QR codes or Vanity URLs.

Configuring Marketing Channels

SiteCatalyst Marketing Channel Configuration menu

While the URLs are being added, SiteCatalyst needs to be set up to record the marketing correctly.  The first step for this is to enable and configure the Marketing Channels reports.  These reports were added to SiteCatalyst last year and are a great addition to the tool.  Further information regarding them can be found at this SiteCatalyst blog post and I have previously written on my vision for how the reports could be improved.

The set up for Marketing Channels is actually very easy and it comes with a wizard to do most of the work for you.  I was going to provide instructions for doing this here but that will be better in a separate blog post.  A few key points to note now though:

  • If nothing else, use the wizard and accept the default settings, it puts you a lot further ahead in SiteCatalyst than you are now.
  • You do need to specify the campaign URL query parameter that you (will) use with your marketing campaigns.
  • You also need to specify the prefix that you are using for each channel e.g. eml for Email, dis for Display, smc for Social Media Campaigns, etc.
  • Ensure the output for each tagged marketing channel is the campaign URL query parameter (the Channel detail becomes the campaign tracking code)
  • New channels can be added immediately the wizard is completed or at later date.

Setting up SAINT classifications

The other piece of configuration work required with SiteCatalyst is to set up SAINT Classifications for Marketing Channels.  These are linked to the First/Last Touch Channel Detail field (doesn’t matter which one) containing the campaign tracking code for all tagged campaigns.  By doing this, we are able to upload all the details of each campaign link based on the unique campaign tracking codes.

Details of SAINT classifications, how to set up and upload data can be found in another SiteCatalyst blog post.  Again I do intend to provide detailed instructions on how to do this specific to Marketing Channels and my Excel tool but it will need to wait on a separate blog post.  Key points to note here are:

  • Classifications for SAINT are set up through the Marketing Channels menu option in Report Suite Manager as per the screenshot above.
  • Ensure the classifications are linked to the First or Last Touch Channel Detail.
  • The classifications to be entered can be found in row 5 of the SiteCatalyst Campaign URL Builder tool.

Uploading SAINT classifications

SAINT Classifications upload menu

The final step is to upload the SAINT classifications file to SiteCatalyst.  Details on how to do this are included within the SiteCatalyst blog post previously referenced.

The SAINT data to be uploaded is generated within the SiteCatalyst Campaign URL Builder.  When you wish to do an upload (either as soon as a new set of URLs is generated or on a periodic basis), simply press the Update SAINT Classifications button in the SAINT Classifications worksheet.  Copy all the new rows of data (old rows are greyed out) to your SAINT Classifications data file, save and upload.

Your Thoughts

Please, do send through your feedback and thoughts.  Will this be a useful tool for companies to manage their marketing campaigns with SiteCatalyst?  Are there any missing features you would like to see included?  I admit that I haven’t set up much error handling so there is a risk of issues there, particularly if users don’t include two classifications fields per channel.

Please get in touch with L3 Analytics if you would like some help with any of:

  • configuring Marketing Channels in SiteCatalyst
  • implementing a process for tracking campaigns within your organisation
  • reviewing the performance of your marketing and optimising spend/performance

I can be contact via phone on 07843617347 or through emailing

Responsive Menu Clicked Image