diff --git a/src/chrome/index.html b/src/chrome/index.html index 67c5f02..943b0a4 100755 --- a/src/chrome/index.html +++ b/src/chrome/index.html @@ -105,6 +105,12 @@ +
+
Experiment
+
+ +
+
diff --git a/src/chrome/js/api.js b/src/chrome/js/api.js index a11bca2..898a08c 100755 --- a/src/chrome/js/api.js +++ b/src/chrome/js/api.js @@ -24,6 +24,7 @@ var GADebuggerAPI = (function() { transactionProps: '#transaction-properties', transactionItemProps: '#transaction-item-properties', socialProps: '#social-properties', + experimentProps: '#experiment-properties', contentGroupProps: '#content-group-properties', captureButton: '#capture-button', clearButton: '#clear-button', @@ -253,6 +254,11 @@ var GADebuggerAPI = (function() { 'Target': beacon.social.target }); + setProperties(elements.experimentProps, beacon.experiment && { + 'ID': beacon.experiment.id, + 'Variant': beacon.experiment.variant + }); + if (beacon.customVars) { beacon.customVars.forEach(function (customVar) { customVars['Slot ' + customVar.slot] = customVar; diff --git a/src/core/uaBeacon.js b/src/core/uaBeacon.js index bd4605f..ae9e878 100755 --- a/src/core/uaBeacon.js +++ b/src/core/uaBeacon.js @@ -240,6 +240,16 @@ var UaBeacon = (function() { } return data; } + }, + experiment: { + get: function() { + if (this.params.xid) { + return { + id: this.params.xid, + variant: parseInt(this.params.xvar, 10) + }; + } + } } });