Created
November 14, 2011 04:31
-
-
Save mehdimehdi/1363236 to your computer and use it in GitHub Desktop.
fire _ptq.push after 5 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)); | |
} | |
}); | |
}); |
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
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));
}
});
});