Click event count on page using jquery


$(document).click(function(e)
  {
    if(e.currentTarget.activeElement.attributes[0])
    {
      var idClicked = e.currentTarget.activeElement.attributes[0].value;
    }
    if (e.currentTarget.activeElement.attributes[1])
    {
      var idClicked1 = e.currentTarget.activeElement.attributes[1].value ;
    }
    if (idClicked == 'loginbutton' || idClicked1 == 'loginModal' || idClicked1 == 'close')
    {
    }
    else
    {
        var auth_token = $.session.get("auth_token");
        var user_id = $.session.get("user_id");
        var pathname = window.location.pathname;
        var patharray = pathname.split("/");
        var pageurl = patharray[patharray.length - 1];
        if (!(auth_token && user_id) && pageurl != "register.php")
        {
          var clickcount = $.session.get("clickcount");
          if (clickcount) {
            clickcount++;
          } else {
            clickcount = 1;
          }
          $.session.set("clickcount"clickcount);
          var newclickcount = $.session.get("clickcount");
          if (newclickcount > 10)
          {
            $('.modal').modal('hide');
            $("#loginModal").modal("show");
            $.session.set("clickcount"0);
          }
        }
    }


  });

Comments

Popular posts from this blog

My Response is on my own Website : Best Quality Backlink Strategy

disk tv connection near agam singh nagar siliguri

Why is Digital Marketing Important? What are the Advantages of Digital Marketing?