Come join our happy hour in Seattle! – Click here.

Build High-Performing Features With Google Analytics and Feature Flags


Split - blog-Blue-google

Google Analytics is the most popular web performance tool out there. Nearly every web app uses it. And given the metrics that GA collects — sessions, pageviews, conversion rates, page load timing — it’s a logical dataset to pair with feature flags. So we’re excited to announce our latest, very highly requested, integration with Google Analytics.

Let’s look under the hood and see what it can do.

To begin, there are two key aspects to understand about integrating with Google Analytics — it’s bi-directional, and it uses SDKs.

Bring Data In, Push Data Out — Analyze Wherever You Want

First, you can send or receive data. This is a two-way integration.

Receive data from GA: You can use these metrics to monitor each feature flag for defects and experiment on new features to determine their impact. Want to determine the lift (or reduction) in time on page for your onboarding flow? Split does that stat for you and calculates the result.

Send data to GA: You can slice, dice, and segment your reporting to your heart’s content. Split provides the feature context — which users see which features. Want to know average time on page for users that saw your new onboarding flow? Easy.

Integrate with Google Analytics and Split Client-Side

Google Analytics and Split both have client-side JavaScript SDKs. We use these to make the integration magic happen. And we use UIDs to join the datasets, keeping everything private.

Sending data to Split requires that you use a plugin for GA’s JavaScript SDK to pass along all metrics that GA collects on the page. All your events! Voila! Don’t worry, you can also filter events if you want.

Sending data to GA requires that you use Split’s JavaScript SDK; now you have a set of functions to send data from the client to GA in a parallel payload to the one GA is already collecting.

Google Analytics to Split: Get Your Data Flowing

Let’s jump in. Sending data from GA to Split gives you the power to:

  • Set alerts in Split on every new feature that degrades performance, as measured by GA.
  • Run experiments in Split that calculate the impact on any GA metric you care about.

So how does this work? Follow along in the docs, if you want. Two things are needed:

To require our plugin, you just need to use the GA ‘require’ command on the trackers you want. Ideally, the ‘splitTracker’ plugin should be required as early as possible, since any hits being tracked before that won’t be picked up by the integration.

  // The analytics initialization snippet
  (function (i, s, o, g, r, a, m) {
    i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
      (i[r].q = i[r].q || []).push(arguments)
    }, i[r].l = 1 * new Date(); a = s.createElement(o),
      m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m)
  })(window, document, 'script', '', 'ga');
  ga('create', 'UA-XXXXX-Y', 'auto');

  // BAD: This GA pageview hit would not be picked up by the integration
  ga('send', 'pageview', '/index');

  // Require the 'splitTracker' plugin before sending any hits you want us to 
  // track. You can require it in as many trackers as you'd like
  ga('require', 'splitTracker');

  // GOOD: This GA pageview hit will be picked up by the integration.
  ga('send', 'pageview', '/index');

The second step is to tell the Split SDK you want to turn on the integration. Sounds easy? It is! Don’t trust us? You can read more about how SDK integrations work.

The constant type for this integration is GOOGLE_ANALYTICS_TO_SPLIT. By default all impressions and events are tracked for the key and trafficType provided in the configuration settings.

The default prefix “ga.” is used for the event types. Event types will be based on the hit data with some constraints to comply with the event type rules. For example, if tracking a pageview hit using ga('send', 'pageview', '/myPagePath') the eventType will be 'ga.pageview' in Split:

var factory = SplitFactory({
  core: {
    authorizationKey: "YOUR_BROWSER_API_KEY",
    // key and traffic type for the resulting Split events will be taken from the factory config.
    key: "CUSTOMER_ID",
    trafficType: "user",
  integrations: [

That’s it! Data will flow through. Every time a given GA hit takes place, we’ll translate it to a Split event for which the eventType will be prefixed with ga. For example, the pageview event would be ga.pageview. It’ll have an EventProperty “page” with the current page path. (Read more about default mappings.)

Once the events are in Split, you can easily use the metric builder to ensure you are measuring exactly what you want, as well as do counts, sums, averages, percent, etc. You can also define whether the data is per user, account, or use the custom granularity you track in GA.

Google Analytics to Split: Protection from Bad Features, Identification of Good Features

Now that you have GA data in Split, you can tie together your web performance data and feature data without having to track all those metrics a second time in Split. You can do all sorts of fun stuff.

One example is setting an alert when a metric degrades. Say ‘session duration’ plummets; this is probably not a good sign. Split will easily identify the feature responsible for the issue. Not only that, we’ll also send the alert to the team who owns that feature flag.

Let’s run an experiment (A/B test) that measures a key goal of your feature. Say you want to increase purchases in your application. Or maybe you need to measure multiple goals: total purchases completed as well as the % of purchases completed. Easy. Split reports each of these metrics back to you in our metrics scorecard, combined with statistical significance to determine a causal relationship. Now you can distinguish real impact from chance.

Split to Google Analytics: Get Set Up

Let’s back it up, flip it, and reverse it. Sending impression data from Split to GA gives you the power to perform your usual analysis in GA, but now you can slice and dice the data with feature-based segments of your users.

Getting set up is dead simple. Are you sensing a theme yet? Again, you can follow in the docs. In the Split JavaScript SDK, you can now include this integration line.

var factory = SplitFactory({
  core: {
    authorizationKey: `YOUR_BROWSER_API_KEY`,
    key: `CUSTOMER_ID`,
  integrations: [

That’s it! Done! Now data is flowing into GA.

Split to Google Analytics: Filter and Segment by Feature

The data from Split can be configured to show up in GA as a custom dimension with a hit-level scope. You can use custom dimensions to filter your reports and to create segments in your GA charts.

Track the Performance of Every Feature

There you have it. You can now easily import and export data between Google Analytics and Split. No need to track additional events or reconcile your data streams. And you can use this data combo to make sure every feature you release doesn’t blow up your SLOs (service level objectives) and performs well for your KPIs. Achievement unlocked!

Learn More About Experimentation, Feature Flags, and Split’s JavaScript SDK

Who isn’t out there excited to get testing with Split and Google Analytics? Interested in more content to inform your experimentation plans? We’ve got you covered:

And as always follow us on Twitter @splitsoftware, or on our YouTube channel for more great content.

Get Split Certified

Split Arcade includes product explainer videos, clickable product tutorials, manipulatable code examples, and interactive challenges.

Switch It On With Split

The Split Feature Data Platform™ gives you the confidence to move fast without breaking things. Set up feature flags and safely deploy to production, controlling who sees which features and when. Connect every flag to contextual data, so you can know if your features are making things better or worse and act without hesitation. Effortlessly conduct feature experiments like A/B tests without slowing down. Whether you’re looking to increase your releases, to decrease your MTTR, or to ignite your dev team without burning them out–Split is both a feature management platform and partnership to revolutionize the way the work gets done. Switch on a free account today, schedule a demo, or contact us for further questions.

Want to Dive Deeper?

We have a lot to explore that can help you understand feature flags. Learn more about benefits, use cases, and real world applications that you can try.

Create Impact With Everything You Build

We’re excited to accompany you on your journey as you build faster, release safer, and launch impactful products.