Skip to content

Instantly share code, notes, and snippets.

@klinkin
Created February 2, 2017 17:12
Show Gist options
  • Save klinkin/35ebdc9620e37ea292c078bd33e38c7a to your computer and use it in GitHub Desktop.
Save klinkin/35ebdc9620e37ea292c078bd33e38c7a to your computer and use it in GitHub Desktop.
GTM ABCD test
<script>
od_test_id = "ABTest-001",
od_twin_id = "",
od_test_name = "Просмотры - Shops",
od_variations_count = 4,
od_exposure_rate = 100,
od_traffic_allocate = [25, 25, 25, 25],
od_cookie_days = 60,
od_cookie_path = "/",
od_analytics = "universal",
od_analytics_id = "{{GoogleAnalyticsId}}",
od_go_live_date = "",
od_go_offline_date = "",
od_reset_date = "";
od_incl_jquery = 0;
function control() {
od_variation_description = "default";
window.exec('setHypothesis', {name: 'default'});
console.log('default');
}
function variationB() {
od_variation_description = "link-block";
window.exec('setHypothesis', {name: 'link-block'});
document.getElementsByClassName("b-sale__sale-text_promo_true")[0].style.background = "green";
console.log('link-block');
}
function variationC() {
od_variation_description = "link-only";
window.exec('setHypothesis', {name: 'link-only'});
document.getElementsByClassName("b-sale__sale-text_promo_true")[0].style.background = "red";
console.log('link-only');
}
function variationD() {
od_variation_description = "block-only";
window.exec('setHypothesis', {name: 'block-only'});
document.getElementsByClassName("b-sale__sale-text_promo_true")[0].style.background = "blue";
console.log('block-only');
}
dataLayer.push({
"event": "call_gtmtesting",
"eventCallback": function() {
od_initializeConfig();
od_loadTest();
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment