Created
November 14, 2012 22:14
-
-
Save mehdimehdi/4075232 to your computer and use it in GitHub Desktop.
reward users for multiple page views
This file contains hidden or 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 ptReady = ptReady || []; | |
ptReady.push(function(){ | |
PT.event.bind('dom.ready', function(){ | |
var route, c = PT.cookie.get('_ptroute'); | |
if (c){ | |
route = PT.serializer.jsonDecode(c); | |
} else { | |
route = []; | |
} | |
if (PT.util.indexOf(route, window.location.pathname) == -1){ | |
route.push(window.location.pathname); | |
} | |
if (route.length == 5){ | |
_ptq.push(['view', 1]); | |
} | |
if (route.length <= 5){ | |
PT.cookie.set('_ptroute', PT.serializer.jsonEncode(route)); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment