Is there a way to stop Google Analytics counting development work as hits?

后端 未结 22 1807
终归单人心
终归单人心 2020-12-02 04:51

I have added the JavaScript that I need to the bottom of my pages so that I can make use of Google Analytics. Only problem is that I am sure that it is counting all my devel

22条回答
  •  借酒劲吻你
    2020-12-02 05:51

    get the request host variable.

    So wrap an if statement around the analytics javascript like this (Ruby-esque pseudocode):

    
    dfsfsdf
    if not (request.host == 'localhost')
      #analytics code here
    elsif (request.host == the server's ip/domain)
      #analytics code here
    else
      #do nothing
    end
    
    

提交回复
热议问题