Created
July 15, 2015 18:30
-
-
Save niechen/1688869e03cbc28613fa to your computer and use it in GitHub Desktop.
slideshow ab test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var slideshowCallback = function (data) { | |
//LIFT Ignite call | |
if( data !== null && data.items.length ) { | |
//Render last slideshow lists with Lift Ignite Response | |
renderResponse( true, data ); | |
//Fire LiftIgnite Track Call | |
BLOCK.lgLoader.track( { | |
elements: $j( '#lastSlideContent > li.item' ), | |
name : ( RNKR.query.isMobile ? 'mobile-slide-show' : 'desktop-slide-show' ), | |
source: 'LI' | |
} ); | |
} | |
else { | |
//Get last page from API | |
$j.ajax( { | |
type : 'GET', | |
url : RNKR.server.relatedListsApiServer + '/lists/' + LIST.id + '/slideshownextlists', | |
data : 'limit=8&imageSize=160&isMobile=' + RNKR.query.isMobile, | |
success : function( response ){ | |
//Catch JSON error | |
if( !response.error ){ | |
//Render last slideshow lists with fall back api | |
renderResponse( false, response ); | |
//Fire LiftIgnite Track call with BASE | |
BLOCK.lgLoader.track( { | |
elements: $j( '#lastSlideContent > li.item' ), | |
name : ( RNKR.query.isMobile ? 'mobile-slide-show' : 'desktop-slide-show' ), | |
source: 'base' | |
} ); | |
} | |
else{ | |
alert( response.errorCode + ': ' + response.errorMessage ); | |
} | |
} | |
} ); | |
} | |
} | |
var abTestHandler = function(hash) { | |
if (hash % 100 > 50) { | |
$p('register', { | |
max: 8, | |
widget: ( RNKR.query.isMobile ? 'mobile-slide-show' : 'desktop-slide-show' ), | |
callback: function(response){ | |
//Save End of Slideshow response | |
slideshowCallback(response); | |
} | |
} ); | |
} | |
$p( 'fetch' ); | |
}; | |
if ( LIST.format === 'SLIDESHOW' ) { | |
$p( 'userHash' , {callback: abTestHandler}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment