Guest User

Eliminar rebote de Google Analytics con JS [Israel Pérez]

a guest
Dec 12th, 2019
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. var ref = document.referrer;
  2. var siteurl = window.location.href;
  3.  
  4.  
  5. if (document.referrer.indexOf("google") > 0){
  6.  
  7. if (ref.indexOf(siteurl)!= -1){
  8. }
  9. else{
  10. (function(window, location) {
  11. history.replaceState(null, document.title, location.pathname+"#!/auth");
  12. history.pushState(null, document.title, location.pathname);
  13.  
  14. window.addEventListener("popstate", function() {
  15. if(location.hash === "#!/auth") {
  16. history.replaceState(null, document.title, location.pathname);
  17. setTimeout(function(){
  18. window.location.href = window.location.protocol + "//" + window.location.hostname + "/random";
  19. },0);
  20. }
  21. }, false);
  22. }(window, location));
  23. }
  24.  
  25. }
Add Comment
Please, Sign In to add comment