From 035cb8fff6671f648a38611d386aa7c8297bfbaa Mon Sep 17 00:00:00 2001 From: Kevin Ball Date: Mon, 1 Aug 2016 14:51:32 -0700 Subject: [PATCH] Add a/b test on directive vs question in ad --- docs/assets/js/docs.ad.js | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/docs/assets/js/docs.ad.js b/docs/assets/js/docs.ad.js index 7334aa426..f908749aa 100644 --- a/docs/assets/js/docs.ad.js +++ b/docs/assets/js/docs.ad.js @@ -1,15 +1,29 @@ +var _kmq = _kmq || []; $(function() { - // TODO: Add alternate between advanced and intro - var topic = $('h1.docs-page-title').text(); - var header = 'Struggling with ' + topic + '?'; - var body = 'Get up to speed FAST, learn straight from the experts who built Foundation.'; - var link = 'http://zurb.com/university/foundation-intro?utm_source=Foundation%20Docs&utm_medium=Docs&utm_content=Struggling&utm_campaign=Docs%20To%20Intro'; - var cta = 'Learn More'; - - var html = '

' + header + '

' + - '

' + body + '

' + - '' + - cta + '
'; - $('#TOCAdUnit').html(html); + + // No need to do a timeout for default case, if KM times out just don't show ad. + _kmq.push(function(){ + // Set up the experiment (this is the meat and potatoes) + var type = KM.ab("Foundation Docs Upsell Type", ["question", "directive"]); + + // TODO: Add alternate between advanced and intro + var topic = $('h1.docs-page-title').text(); + var header; + if (type === 'directive') { + header = 'Master ' + topic; + } else { + header = 'Struggling with ' + topic + '?'; + } + var body = 'Get up to speed FAST, learn straight from the experts who built Foundation.'; + var link = 'http://zurb.com/university/foundation-intro?utm_source=Foundation%20Docs&utm_medium=Docs&utm_content=Struggling&utm_campaign=Docs%20To%20Intro'; + var cta = 'Learn More'; + + var html = '

' + header + '

' + + '

' + body + '

' + + '' + + cta + '
'; + $('#TOCAdUnit').html(html); + + }); }); -- 2.47.2