Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var PT = PT || {
- route: {
- setCookie: function(cookie_name,value) {
- var c_value=escape(value);
- document.cookie=cookie_name + "=" + c_value;
- },
- getCookie: function(cookie_name) {
- var i,x,y,ARRcookies=document.cookie.split(";");
- for (i=0;i<ARRcookies.length;i++) {
- x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
- y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
- x=x.replace(/^\s+|\s+$/g,"");
- if (x==cookie_name) {
- return unescape(y);
- }
- }
- },
- count: function() {
- var new_cookie = PT.route.getCookie("_ptroute");
- var s = new_cookie.split("||||");
- if (s.length == 5) {
- _ptq.push(["view", "1"]);
- return false;
- }
- if ($.inArray(window.location.pathname,s) === -1) {
- console.log("not visited");
- PT.route.setCookie("_ptroute",new_cookie+"||||"+window.location.pathname);
- }
- }
- }
- };
- $(document).ready(function() {
- PT.route.count();
- });
Add Comment
Please, Sign In to add comment