A Data Strategy for Google Analytics, for Ecommerce

In my last article, I wrote about four ways that Google Analytics data can be confusing to users. The method Google used to develop Analytics is the root cause for some of the issues, but there are measures you can take to avoid any issues over which you have control.

You can accomplish this by using a robust strategy for storing and structuring data in Google Analytics. Here are the top five components of this data strategy, for ecommerce sites.

1. Create a Hierarchy of Views

Google Analytics uses an account > property > view hierarchy to organize data, as shown below. In this hierarchy, users access “views” to get to the web analytics data.

Google Analytics uses an account > property > view hierarchy to organize data.

Google Analytics uses an account > property > view hierarchy to organize data.

By default, Google Analytics creates a single view called “All Web Site Data,” which contains all the data for a given website. Because you cannot fix data in Google Analytics retroactively, it becomes necessary to maintain an unfiltered view of the original dataset. Doing so provides a way to look back at the data before filters or other view levels override changes.

Set up these three views of your analytics data:

  • Production Profile;
  • Staging Profile;
  • Raw Profile.

The production profile is the default view to be used by analysts at your company. The staging view is where you can test filters and overrides before implementing them in the production profile. Finally, the raw profile is the backup to refer to if something goes wrong in the production profile.

You can create views in two ways — either by creating a view with default presets or by copying the settings from another view. Because a new view does not copy the data over from the original, it is important to set up the view hierarchy as one of the first steps when implementing Google Analytics.

Set up the view hierarchy as one of the first steps.

Set up the view hierarchy as one of the first steps.

2. Add Additional Context to Data

To record ecommerce data, Google Analytics requires some basic information, such as product name/id and transaction id. However, to make the best use of analytics, it can be helpful to add additional context to this data.

Consider adding three extra pieces of information that can help drive actionable insights. Note that Google Analytics does not require these, but they can be extremely beneficial for understanding user behavior. The three are:

  • User ID. Assign a user id to all visitors. This user id needs to be data that is not personally identifiable; else it will violate Google Analytics’ terms of usage. Assigning a user id has many benefits. For example, it can help stitch together user behavior across devices. More importantly, it allows the creation of cohorts based on user characteristics that are known to you. (You can find more information about how to leverage user ids in a blog post by web analytics expert, Justin Cutroni.)
  • Customer vs. visitor. Implementing a user id can be difficult because it requires a robust infrastructure on the backend, to determine the user id for a given visitor. An easier implementation is to tag website visitors as customers. You can do this once a visitor completes a transaction or if the visitor returns through a customer-targeted campaign. The advantage of tagging visitors as customers is to understand non-customer behavior and improve their conversion on the site.
  • Group content logically. Content Grouping is an advanced feature in Google Analytics that enables users to analyze and compare the performance of sets of pages. Consider, for example, a retailer that sells jackets for men, women, and children. By grouping product pages into men’s jackets, women’s jackets, and kids’ jackets, analysts will be able to compare the performance of these three categories of products. (Justin Cutroni provides further detail on how to leverage content groups in a blog post on the topic.)

3. Clean Data Before It Enters Google Analytics

Google Analytics provides a powerful way to modify data before storing it. You can accomplish this by using filters. However, because Google Analytics permanently alters the data, care must be taken when building these filters.

Some of the most common uses of filters are to consolidate URLs, delete undesirable data, and fix known tracking issues. Four key filters to implement are as follows:

  • Force lowercase. As mentioned in my previous article, Google Analytics is case sensitive. So it is a good practice to apply a filter that will force all URLs and campaign parameters to get recorded in lower case, as displayed in the screenshot below.

    Implement a filter, to force all URLs and campaign parameters to record in lower case.

    Implement a filter to force all URLs and campaign parameters to record in lower case.

  • Remove spammy referrals. Referral spam in Google Analytics is an ongoing problem. One way to address this is to create filters, to remove such traffic.

    Create a filter to remove spam.

    Create a filter, to remove spam.

  • Consolidate URLs. You may have run into problems where the same page is accessible through multiple URLs. For example, shows the same content as In such cases, the pageviews for this page may get split across the two URLs. To get Google Analytics to record this as a single URL, remove the “index.html” part of the URL before storing in Google Analytics. You can address this through a search and replace filter, as illustrated below.

    Consolidate URLs using a search and replace filter.

    Consolidate URLs using a search and replace filter.

  • Remove unnecessary query string parameters. Google Analytics uses query string parameters such as “utm_source” to categorize traffic. However, it automatically strips URLs of these parameters before recording them, although any other parameters are not stripped out. For example, and will be tracked as two separate URLs in Google Analytics. To avoid this, create a list of all query string parameters that are unnecessary for tracking and update the “Exclude URL Query Parameters” setting under “View Settings.”

    Create a list of all query unnecessary string parameters.

    Create a list of all unnecessary query string parameters.

4. Implement Cross-domain Tracking

If your business uses more than one domain to draw traffic, you may want to analyze the performance of these domains together, to get a clear picture of the actual size of traffic across these sites.

Since users may visit both domains within the same session, the solution is more complex than simply adding traffic counts across domains. Google Analytics provides the ability to implement cross-domain across domains, to consolidate data.

One thing to keep in mind when implementing cross-domain tracking is to prepend the domain name into the URL so that it is possible to differentiate the pages of each domain in the unified Google Analytics view of the two.

5. Tracking of Transactions on Third-party Domains

Many leading ecommerce platforms process transactions on their domain instead of on their clients’ domains (e.g., Shopify). In most cases, the platform provider has already taken steps to ensure that referral exclusion and cross-domain tracking is in place, to make certain that you have a full view of the customer’s journey through checkout.

In some instances (e.g., PayPal processing), this is not the case. For such situations, make sure that you have referral exclusion, cross-domain tracking, and transaction information sharing in place, to get a full picture of your customers’ activities on your site.

Google Analytics is a complex tool that can provide deep, actionable insights. Without quality control, however, it can also mislead. Taking time to craft a robust data strategy can improve the quality of Google Analytics data and maximize the benefits it can provide.

Abhi Jadhav
Abhi Jadhav
Bio   •   RSS Feed