From: Kevin Ball Date: Mon, 1 Aug 2016 21:51:32 +0000 (-0700) Subject: Add a/b test on directive vs question in ad X-Git-Tag: v6.2.4-rc1~32^2~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F9074%2Fhead;p=thirdparty%2Ffoundation%2Ffoundation-sites.git Add a/b test on directive vs question in ad --- 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); + + }); });