Covid-19: Valuable Marketing Resources and Information.

Restore Service Provider to Google Analytics

Theo Bennett - August 7, 2020

As we reported earlier this year, the deprecation of the Service Provider dimension on February 4th, 2020 broke a key method of fighting bot traffic in Google Analytics (GA). Some organizations also have dependencies on the service provider dimension outside of just fighting bots.

You can follow the link above to learn more about how this valuable dimension was used and why it was important. In this post, I will walk you through one of the solutions I mentioned: Using an IP Lookup Service to get the user’s service provider and capture this as a custom dimension in Google Analytics.

IP Lookup Services.

Without getting bogged down in the minutiae of Internet basics, let us accept that each request you make has your public IP address attached to it. Without it, you would never get the data your requested as the routers of internet traffic would not know where to send your data.

There are thousands of IP lookup services that can take a public IP address and provide reverse DNS data based on IP address supplied. Look at the data returned from one of these, whatismyipaddress.com:

The ISP is listed as Comcast Cable which is in fact my current ISP and is the data that was previously stored in Google Analytics.

To restore the service provider data to Google Analytics, the first step is to select a provider for your reverse DNS / IP Lookup. As I mentioned earlier, there are many providers. Two that offer free API access (with limits) are https://ipstack.com/ and https://ipgeolocation.io/. Once you have selected a provider, you have two choices:

  1. Deploy a client-side solution (works entirely in the browser).
  2. Deploy a server-side solution that is owned and maintained by your IT and Development team.

We recommend the latter; that is, a solution developed and owned by your IT team that queries an IP Lookup API and then deploys this data in the Google Tag Manager (GTM) dataLayer; then GTM is used to pass the Service Provider / ISP data back to Google Analytics (GA) via a Custom Dimension.

More on the GTM data layer.

Create the Custom Dimension in Google Analytics

Once the ISP/ Service Provider is added to the dataLayer, you will have a few quick changes to make in GA and GTM. In GA, go to the property tree in the admin section of your Google Analytics account and select Custom Dimensions.

Add a session scoped custom dimension and name it something that makes sense, like “Service Provider” and remember the index number.

Modify Google Tag Manager (GTM)

Now that the custom dimension is ready to receive data, configure GTM to pass this data into GA. First add a dataLayer variable to with the name of the “name:value” pair that you are trying to capture (“serviceProvider” in the screenshot below; see the dataLayer Reference for more information).

Next, modify your GA Variable and add the custom dimension with the index number (6 in this example) and the name of the variable you created.

Publish the container and service provider will begin to populate in the Google Analytics custom dimension you created.

Analyze and Filter

Any old Service Provider filters you had can be recreated on the view level and will now work to remove bot traffic. This is an important distinction; your old filters will not work and new filters that utilize custom dimensions need to be created on the view level, not the account level.

Once you’ve completed your changes, you can now also use the service provider in much the same way that you did before — with the exception that custom dimensions can only be added to “standard” GA reports as a secondary dimension or via a custom report. Custom dimensions can also be used easily in Google Data Studio.

By using this or the other tactics we have presented in this series of posts, you can keep your data free from the clutter of bot traffic and better understand and meet the needs of real site users.

MoreVisibility is a Google certified partner for GA, GTM, Google Optimize and Google Data Studio. If you need help deploying this or any other solutions related to these tools, call us now at 800-787-0497 or fill out a contact form today.

© 2020 MoreVisibility. All rights reserved.