Google Analytics integration
Last updated
Last updated
You can send A/B test exposures and feature flag values from Hypertune to Google Analytics to add comparisons and breakdowns to your Google Analytics reports. This lets you see the impact of feature releases on key metrics.
Add a new file called trackHypertuneExposure.ts
that creates and exports a helper function to send A/B test exposures to Google Analytics:
Then call this function immediately after getting your feature flag:
Open Google Analytics. Click Admin in the left sidebar, then Custom definitions, then Create custom dimension. Set:
Scope to User
Dimension name and User property to the dimension name you set in the call to trackHypertuneExposure
, e.g. ht_new_editor_test
Here's what this looks like:
Navigate to any report, then:
In the top bar click Add comparison
Set Dimension to the custom dimension for your A/B test, e.g. ht_new_editor_test
Set Match Type to contains
Set Value to true
Repeat steps 1 to 4 but with Value set to false
You can now compare the test and control arms of your A/B test across all results in the report.
To track exposures for a new A/B test and view its results in Google Analytics, you just need to:
Call trackHypertuneExposure
in your code immediately after you access its flag
Create a custom dimension in Google Analytics with the same dimension name you passed to trackHypertuneExposure
Then you can add comparisons to compare the test and control arms of your A/B test across all your reports.