Follow

Collecting Variation data

About this page

Learn how to collect Variation data from an Experiment using our JavaScript API.

Collecting Variation data using the JavaScript API

To send Experiment data to external analytic tools that are not officially supported by Kaizen Platform, use our JavaScript API.

Here is how to insert the JavaScript snippet:

Sample Code : Insert customized script below Kaizen Platform JavaScript Code

<!-- Kaizen Platform JavaScript code -->
<script data-kz-key="XXXXXXXXXXXXXXXX"
  data-kz-namespace="kzs"
  src="//cdn.kaizenplatform.net/s/XX/XXXXXXXXXXXXXX.js"></script>
<!-- customized script -->
<script>
kzs("getVariation", function(data, state) {
  if (state == "decided") {
    sendToAnalytics({ experimentId: data.experimentId, variationId: data.variationId });
  }
});
</script>

Sample Code : Insert customized script above Kaizen Platform JavaScript Code

<!-- customized scripts -->
<script>
// need this line only when calling site-js API before site-js script tag
var kzs = window.kzs || function() { var _ = window.kzs; return (_.q || (_.q = [])).push(arguments); };
 kzs("getVariation", function(data, state) {
   if (state == "decided") {
     sendToAnalytics({ experimentId: data.experimentId, variationId: data.variationId });
   }
 });
</script>
<!-- Kaizen Platform JavaScript code -->
<script data-kz-key="XXXXXXXXXXXXXXXX" data-kz-namespace="kzs" src="//cdn.kaizenplatform.net/s/XX/XXXXXXXXXXXXXX.js" ></script>

Callback details

The kzs("getVariation", function(data, state){}); details are:

State

  • unmatched : This page does not match any experience.
  • matched : This page has already matched an Experience. However, an Variation still has not been decided.
  • decided : the Experience & the Variation is decided.

data

NameDescriptionExample
experimentId Experiment ID '100102'
experimentType Experiment Type 'singlePageTest': Basic A/B Test
'redirectTest': Split URL Test
roundId Round ID '120'
roundType Round Type 'initial': Initial
'interim': In Interim Round
'competition': In Competition Round
roundStateId Round Status ID '135'
roundStateType Round Status 'active': Active
'paused': Paused
variationId Variation ID '100150'
gaSlot Google Classic Analytics Dimension index of Custom dimension 1
gaCTrack Google Classic Analytics Custom tracker t2
scVars Adobe Analytics Variable names eVar72, prop44
uaCDim Google Universal Analytics Dimension index of Custom dimension 1
uaCTrack Google Universal Analytics Custom tracker t2

Any values in the collected data that do not match, will be mentioned as undefined values.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.