Open asokawotulo opened 3 years ago
I noticed that there was a discrepancy between the total number of sessions and the experiment sessions that were reported on Google Analytics.
After enabling the debug option for Google Analytics I noticed that the ga("set", "exp", exp) wasn't being called consistently.
ga("set", "exp", exp)
Below is a workaround using @nuxtjs/google-analytics that seems to work for now.
@nuxtjs/google-analytics
// experiments.client.js export default ({ $ga, $exp: { experimentID, $variantIndexes } }) => { if (!experimentID) return; const exp = experimentID + "." + $variantIndexes.join("-"); $ga.set("exp", exp); };
// nuxt.config.js extendPlugins(plugins) { plugins.push("~/plugins/experiments.client.js"); return plugins; }
https://codesandbox.io/s/nuxt-google-optimize-issue-vkmho
Console should output:
Executing Google Analytics commands. Running command: ga("set", "exp", "test.0")
The command ga("set", "exp", "test.0") was never called
ga("set", "exp", "test.0")
Description
I noticed that there was a discrepancy between the total number of sessions and the experiment sessions that were reported on Google Analytics.
After enabling the debug option for Google Analytics I noticed that the
ga("set", "exp", exp)
wasn't being called consistently.Below is a workaround using
@nuxtjs/google-analytics
that seems to work for now.Reproduction
https://codesandbox.io/s/nuxt-google-optimize-issue-vkmho
What is Expected?
Console should output:
What is actually happening?
The command
ga("set", "exp", "test.0")
was never called