You can send flag values and experiment exposures 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.
1. Send experiment exposures to Google Analytics
Add a new file called trackHypertuneExposure.ts that creates and exports a helper function to send experiment exposures to Google Analytics:
declareconstwindow:any;exportdefaultfunctiontrackHypertuneExposure(dimensionName:string,value:any,):void{window.gtag("event","hypertune_exposure",{ user_properties:{ [dimensionName]: value },});}
declareconstwindow:any;exportdefaultfunctiontrackHypertuneExposure(dimensionName:string,value:any,):void{window.analytics.track("hypertune_exposure",{ user_properties:{ [dimensionName]: value },});}
Also make sure you've set up a Google Analytics destination in Segment with a mapping that forwards all events including their properties. Here's an example:
Then call this function immediately after getting your feature flag: