As counter-intuitive as it may sound, using Google Tag Manager in Segment can have some benefits. I have listed four reasons why you should consider using Google Tag Manager as a destination in Segment.

One does not simply call Segment a tag manager

segment not a tag manager

Yes, that is my opinion. Having worked on various Segment projects in the past and as a Segment certified consultant, I feel confident in defending that Segment and Google Tag Manager are nothing like each other. A common misconception stems from Segment’s origins as a data connectivity solution.

Around nine years ago, when I started working with Segment, its only purpose was to connect data sources and destinations. A single implementation of its tracking code would allow you to distribute the data to numerous platforms using either client-side injections or APIs through a generic approach to collecting data and a library of data destinations. This is still the case today (albeit it is more sophisticated), but Segment has gone further. Today, Segment is also a full-fledged customer data platform, data quality tool, and privacy monitor solution.

How does Segment’s Google Tag Manager destination work?

Before we look into the four situations where you should use Segment’s Google Tag Manager destination, let’s look at how it works.

When the analytics.js SDK is used in your website, you can enable so-called device-mode (client-side) destinations in your Segment workspace. These device-mode destinations inject scripts back into the analytics.js SDK container, ironically, just like Google Tag Manager would do. Using the Javascript developer console in your browser, you can see which destinations have been enabled under the network tab.

segment google tag manager integration

We can see that Google Tag Manager has been enabled in Segment.

What happens next? When Google Tag Manager has been enabled and injected into the Segment container, it will get instantiated just like it usually would. Any valid triggers will load any linked tags.

instantiate Google Tag Manager through Segment

The real beauty of Segment, in my honest opinion, is how its implementation is linked directly to any client-side destinations. Regarding Google Tag Manager, any event tracked by the implementation will be pushed into the dataLayer for you to use.

feed dataLayer through Segment Google Tag Manager destination

This will allow you to leverage your existing implementation directly in Google Tag Manager using the same data points and values.

When to use Google Tag Manager in Segment

There are four situations in which I would recommend you use Google Tag Manager in Segment.

  1. If Segment does not offer a device-mode destination for your required SaaS
  2. If Segment’s built-in destination does not provide you the flexibility you need
  3. If you cannot implement Segment Consent Manager
  4. If your time to market is more urgent than assigning resources

Let me elaborate on each situation a little bit more.

Situation #1. No out-of-the-box destination solution

It is a fact that I have had to deal with many times. Segment offers many out-of-the-box destination solutions such as Google Ads (GTAG), Facebook Pixel, Google Analytics Universal, Google Analytics 4, and so on. However, some popular marketing platforms are missing, and two common ones that I frequently work with are Reddit and Snapchat.

In these cases, Google Tag Manager offers the best solution to getting the tags up and running. Enabling Google Tag Manager through Segment will provide you with a great solution in the future.

You can find a complete list of Segment destinations here.

Situation #2. Not enough flexibility

Segment’s destinations only work as good as your core implementation. So there can be limits. I had a great example using Google Analytics Universal, but now that this will be deprecated, its effect is slightly less, but let’s try.

Example A: Google Analytics Universal

When you enable a destination in Segment, you are offered various settings to fine-tune the passing through of data. In the case of Google Analytics Universal, there were two significant challenges:

  1. Assigning a product scoped custom dimensions. Since the settings in Segment would only allow me to set a single parameter per call, it could not loop through an array of product objects and add additional product variables using the out-of-the-box destination.
    segment google analytics custom dimensions
  2. Assigning a single parameter sent from Segment to multiple custom dimensions. There are cases where you want to track a value on various scope levels, hit/session/user, etc., and Segment will, unfortunately, not allow this.

Example B: Multi-Domain Advertising

There are cases where you will be setting up advertising accounts per geographical area linked to a matching top-level domain. Each account could potentially have its own account id. If you have a single Segment workspace setup for all your top-level domains, it will be challenging to assign those individual account ids per domain correctly. Google Tag Manager allows the user of the Look-up Table variable to solve for this solution, and Segment however does not.

In both cases, Google Tag Manager offers a solution for the challenges I faced. I agree that it is not an ideal scenario to work with, but the added flexibility made it possible to achieve the goal.

Situation #3. Your website runs on something other than React.js

Segment Consent Manager is a Github repository that will allow anyone using React.js to implement a consent management tool onto your website. Regardless of all the available customizations, the true power lies in the direct Segment integration. In other words, a user’s consent level will automatically determine if a device-mode destination (client-side tag) will trigger or not. There is no need to add any conditional parameters to the destination in Segment, which is part of the Google Tag Manager process.

If you don’t use React.js, you are out of luck. You could still build a solution that integrates with your frontend tech stack, but Google Tag Manager would be a more straightforward solution.

Situation #4. When time is of the essence, or you don’t have enough resources

Time and resources are the most prominent arguments for using Google Tag Manager. Ironically, you can implement Segment through an existing Google Tag Manager implementation. Doing so could saddle you with extra work as you would need to maintain two types of implementations. So when would you want to use Google Tag Manager?

  1. You want to perform a Proof of Concept with Segment
  2. You want to perform a Proof of Concept with a new advertising platform
  3. You don’t have the resources to (re)implement all of your existing data points
  4. You don’t have time to implement new data points into your website

Let’s face it, finding extra resources to work with Google Tag Manager is easier and faster than for Segment. The same can be said for implementing or expanding an implementation with Google Tag Manager. Do it if you need to because the power is in the data, not the tools.

My advice: Data first!

Segment is a powerful tool to manage your data in so many ways. However, one must never lose sight of what is important, the data, not the tool.

That said, I would always argue for a solid hardcoded implementation of Segment on all your platforms. Maintaining a synchronized setup across web, iOS, Android, and backend systems not only leverages Segment as a solution but also brings stability to data quality and potential privacy leaks. Much will depend on your availability (or commitment) of resources to achieve this level of data collection.

Using Google Tag Manager in Segment is not frowned upon, and it is a personal decision to make, one that should be made from the perspective of your data collection goals. If you have any questions about this topic, please contact me.