Your first question should be extra to what? It’s always great to get five Google Analytics tips, tricks & hacks, its even better to get more of them so why are these extra? Well I am speaking at the ObservePoint Analytics Summit this Thurs 17th Nov and there I am giving the first 25 Google Analytics tips, tricks and hacks. These are extra to that list.
Quick little bit of background. My original plan was to give 10 tips, tricks & hacks in 30 min. But then I decided that wasn’t a big enough challenge. I wanted to take it further, aim for one per minute and get up to 30. It appears I was too ambitious, during recording it became apparent that in order to focus on quality, I needed to cut back. So these are the five that didn’t make the final cut.
Oh yeah, taping, another piece of explanation required. The Analytics Summit is an entirely online conference, all the sessions have been pre-recorded. Not sure about everyone else but I was pretty good… Even better news, the entire conference is free to attend. Register via Analytics Summit and listen to not just myself but other analytics experts from around the world. Did I mention it was free???
The five tips include two related to Enhanced Ecommerce, a use case for two vital pieces of customer information to capture, a general tracking tip to make information more useful and a plea to invest time to understand Google Analytics definitions so you can understand the data you are looking at.
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
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
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.
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 email@example.com or +44 (0)20 8004 0835.
We like to keep busy here at L3 Analytics and approaching the Christmas slow down period, a couple of our team have spare capacity. To fill this, we are offering a significantly reduced price on the L3 Analytics Insights project, a five day deep dive that produces a set of recommendations to improve performance plus presentation back to you on these findings (only available to organisations with Google Analytics).
We have capacity to perform two, potentially three of these projects. The reduced price we are offering them for is £2,250 + VAT. To be more flexible still, we are happy for this to be registered against your budget for this quarter or next quarter; we can adjust payment terms accordingly. So that we can start the projects as quickly as possible, they will be allocated on a first come, first served basis. This offer will expire at the end of this week, so at 5pm on 27th Nov ‘15.
For the organisations that claim the offer, one of our Digital Analytics consultants will review your Google Analytics data, picking out key points and recommending actions you can take to better achieve your business objectives/make more money. The project is topped and tailed with meetings, initially to discuss your business and key areas to investigate, concluding with the presentation on our findings and recommendations. This final presentation will be held either pre Christmas or early Jan. If you are London based, meetings will be in person.
Over the five-day analysis period, we will combine our analytics and business experience to dive deep into your numbers and provide solid guidance as to how you can move forward. Typical tasks include:
Map out your website and customer journeys
Create a Measurement Framework
Identify key conversion points and actions
Build a Performance Diagnostic report
Review performance of different marketing channels & other traffic sources
Examine how users navigate through your website and the areas they are most interested in
Evaluate behaviour against completion rates of macro and micro conversion actions
Give actionable insights based on your current business performance
Recommend changes & actions to take to improve performance
Suggesting GA set-up changes to enhance the quality of information being collected
If you know there are valuable insights hidden away within your Google Analytics account but don’t know how to get your hands on them, now is the time to ask. Give Peter a call on 07843617347 or email us at firstname.lastname@example.org with any questions or to sign up.
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.
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:
The 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.
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.
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:
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.
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…
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.
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. ^/product-([0-9]+)/([0-9]+)/([a-z]+)
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.
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?
The years appear to be flying by as L3 Analytics turned five last week. A long, slow, usually very busy and at times painful experience but something that has achieved a lot. We are now a team of six full timers with another confirmed for next month plus three more providing support. Not yet at the level I want things to be at, lots of growth to come.
The best moments remain those when clients realise the information available to them through their analytics tool. That it is not just another task on their to-do list or an impossibly complicated tool without value but something which they can use and get value out of. Especially when they are immediately learning more about their own business, work and customers than they knew previously and better yet, talking actions based on this information.
Actually not entirely true. The best moments are when clients find this out through the work of my team. It is a great feeling doing great work, even better feeling seeing others able to do the same thanks to you.
On a personal note, while it is not part of L3 Analytics, I am incredibly proud of everything that has been achieved through the creation of MeasureCamp and MeasureBowling. There are teams of people working on each and Nicolas Malo does an amazing job managing MeasureBowling but crazy to see what can come from an idea with a bit of hard work.
The side benefit has been invitations to speak at conferences around the world (come join me at eMetrics London, iLive Riga and/or Superweek Hungary). Something I very much enjoy, plan to continue doing and intend to work harder at developing my skills in this area. I don’t intend to ever charge for speaking (covering my expenses is nice) but I refuse to pay myself for the experience of sharing my knowledge. A big objective for me over the next five years is to have more Digital conferences asking me to speak as their recognised authority on Digital Analytics.
So announcement time. While it has been on the L3 Analytics to-do list for a very long time, we recently submitted our application to become a Google Analytics Certified Partner and have been approved. We will finally be at the GA Summit and get to hear all about the upcoming features that I won’t be able to tell anyone about. Next tasks there are to become a GTM Certified Partner and to become an approved reseller of Google Analytics Premium.
Other goals? To grow the team and to help more clients. To develop simpler ways of working that are even better at enabling everyone in an organisation to get value out of Digital Analytics (this is incredibly complicated). To develop new solutions around optimisation and forecasting.
For a more direct goal, I want to get back into writing regular blog posts and I think one every two weeks will do this nicely. There are so many ideas I want to share (and get feedback on). Given it is already October, targeting six more posts this year, let’s see how I go…
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.
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:
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.
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).
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.
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.
Conversion funnel diagrams are incredibly useful to understand how visitors go through your website to achieve a goal. Most Web Analytics tools provide reports to show the conversion rate between each key stage but they don’t often show exactly the information I need. Therefore, when I analyse a new website, I love drawing up my own funnels. It helps to understand how the website works and can provide additional insights:
Drawing up your conversion paths is useful to identify all stages
Analysing optional steps can be painful with standard funnel reports
Discovering quick wins to improve the customer journey becomes easier
1 – Making a draft with a pencil
To start, we only need a pencil and a piece of paper. There is no need to do anything beautiful at this stage. The aim is to represent required and optional steps to complete a goal. For example, to order online through a retail website visitors might go through the following stages:
Here two steps are optional: The Login and Billing Address pages.
2 – Representing the funnel in Excel
The next task consists of reproducing the draft in Excel. This can be achieved by many methods and there is no need to be an Excel Guru. For example I could use this type of template:
Each rectangle represents a stage. At the top, we can see the number of visits starting the stage and at the bottom, the number of visits completing it. The step completion rate which is the ratio between both metrics is shown at the left:
The checkout completion rate represents the overall performance of the checkout process. It’s the number of visits viewing the confirmation page divided by the number of visits starting the checkout process:
3 – Filling in the data
The data can be imported from the web analytics tool. A fast method is to simply manually enter data from the web analytics tool into the excel file (a longer term solution is to use the API or an Excel plugin).
After a quick look at the drawing, I can see that the completion rate for the Login and Payment details are lower than the other ones. I should look at those two stages more into details to see if we can identify any quick wins to improve the checkout process.
Going further into the analysis
To understand why a step performs less than the other ones, I love comparing the data for a few key segments. For example, looking at the step completion rates by browser or device category is a good approach as we can quickly identify levers to improve the overall website conversion rate.
What you can end up with is a diagnostic data matrix and we will study this method more in details in the next blog post…
Finally, your turn – Have you ever felt the need to draw up your own funnel to have a better understanding of your website conversion paths? Would you go outside your standard Web Analytics reports to look at the performance of all optional steps? What are your favourite methods/tools to visualise funnels?
This blog post is not meant to replace that ebook but to be a quick reference guide followed by some practical applications within Google Analytics of regular expressions.
Where you use regular expressions
Regular expressions end up being used in what feels like most Google Analytics functionality. I am going to forget at least one use but here are the key areas:
Applying report filters (particularly with the following reports)
Keywords (where provided)
Creating View (Profile) filters in the configuration – examples include:
Exclude IP Addresses or robot traffic
Rename traffic sources
Setting up Goals
Including filters while creating Custom Reports or Dashboard widgets
With that list of uses, regex becomes something you MUST know if you are planning on using Google Analytics on a regular basis to get real value out of it.
The key characters
Regular expressions are built around a set of wildcard characters. But whereas you may think of * as a match anything character, there is a lot more flexibility here. The below is not a complete list but what you need to know to get started.
Hat (technically called a caret) ^
This is a regular expression for “begins with”
Matches any string that contains whatever follows the ^
E.g. ^aa will match “aaa”, “aab” but not “baa”
Use for identifying category of pages e.g. ^/services
Dollar sign $
This is the regular expression for “ends with”
It is the simple opposite of ^
E.g. aa$ will match “aaa”, “baa” but not “aab”
Use for identifying category of pages e.g. html$ (no URL query parameters)
The simplest regex character, the dot can replace any character
E.g. a.b will match “aab”, “abb”, “a5b” or “a!b” but not “ab”
Use to correct for spelling mistakes e.g. ach..ve (is it ie or ei?)
The pipe means OR and is one of the simplest characters to use when learning regex
E.g. aa|bb will match “aa” or “bb” but not “aabb” or “ab”
Use when identifying social media traffic e.g. facebook|twitter
Question Mark ?
The previous character is optional and is not required for that string to match
So a? means match a or blank
e.g. ba?b will match “bb”, “bab” but not “baaab”
Use with multi word brand names where the space may not be included e.g. l3 ?analytics
Plus symbol +
The plus symbol means match one or more of the previous character
So a+ means match one or more a’s
e.g. ba+b will match “bab” and “baaab”
Asterisk symbol *
Similar to the plus symbol except it matches zero or more characters
So a* means match zero or more a’s
e.g. ba*b will match “bab”, “baaab” and “bb”
Square brackets 
Square brackets are where it starts to get complicated, they mean include one of these characters
So [abc] could match any of a, b or c
Square brackets can also include characters so [ab12_/] means match one of a, b, 1, 2, _ or /
And you can also use a range where [a-z0-9] means match one of any letter or any number
Round brackets ()
These are like a mathematical formula in that their contents are processed independently
E.g. b(a|c)b will match “bab” or “bcb” but not “bacb”, “ba” or “bc”
In plain English, this example means match b, then either a OR c, then another b
With all of these wildcard characters, sometimes they are the characters you need to identify in a string
In that situation, use the backslash to indicate the character is not a wildcard
E.g. ba?b will match “ba?b” but not “bb” or “bab”
More complicated examples
I gave pretty simple examples when describing these wildcards but the real power when you combine wildcards. Some examples of these combinations are:
.* will match any string
.+ will match non blank string
[a-z]+ will match one or more letters
[a-z0-9-_]+ will match one or more letters, numbers, dashes or underscores – as is found in most page names
a(cat|dog)?b will match “acatb”, “adogb” or (as the entire contents of the () are optional), “ab”
^/[0-9]+/[0-9]+/ will match pages names for blog posts that commence with /yyyy/mm/<blog post title>
Use cases in Google Analytics
Valid Traffic Only
Your live Google Analytics profiles (I can’t get used to calling them Views) should only include data from your live website. If L3 Analytics had three subdomains (www, blog and support), the regular expression to use in the profile filter is:
This translates as “starts with www. OR blog. OR support. OR is blank, followed by l3analytics.com, ending there”.
Identify Social Media traffic
Traffic from Social Media networks that is not tagged with campaign parameters will appear with a medium of “referral” and a source of the social media network domain name. You can rename the medium to social media for all this traffic using the following regular expression for the source:
It can be easy to identify a subset of pages (e.g. product pages, article pages) if there is a good URL structure in place. If not, it can be incredibly difficult but using regular expressions makes it possible/easier. Let’s use Paperchase as an example:
To identify department pages (within the All Pages report), they will need to filter on
To identify product list pages (within the All Pages report), they will need to filter on
To identify product pages (within the All Pages report), they will need to filter on
These examples are not exact as there appears to be some variation in URLs but will cover most cases. Basically looking to have one string prior to icat for department level pages and two strings for product list level. There are many more details that could be identified on filters that are applied to these pages.
Similar logic is used if you want to set Goals for viewing a Product page or for using a filter on a Product List page.
Taking the previous logic to the next level, these pages can be renamed using Profile Filters and regular expressions. A key change here is that anything within a () is remembered by Google Analytics and can be used within a string that is output.
So, to rename blog posts that use the format of /yyyy/mm/<blog post title>, use a Custom Advanced filter and select Request URI (page name) for field A and Output. The regular expression is then:
Field A – ^/[0-9]+/[0-9]+/(.+)
Output – /blog/post/$A1
Where $A1 is the blog post title
You can then identify all blog posts by simply filtering on “/blog/post”.
What would you like to know
Ok, regular expressions are very powerful which means they can also get very complicated. I tend to choose those advanced complicated examples myself but it would be more useful to provide examples that everyone can follow.
Please leave a comment or send me an email (email@example.com) if you have a use case for a regular expression but don’t know what the regular expression is. I can answer and use for a future blog post (if ok with you). This will stop me getting too advanced, focusing instead on practical everyday usage.