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

后端 未结 22 1764
终归单人心
终归单人心 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:45

    If you're not using static IP, setting IP filters on GA can't help you.

    Set an environment variable and conditionally display it. Take the following Ruby on Rails code, for instance:

    <% unless RAILS_ENV == "development" %>
        
    <% end %>
    

    You can extend this behavior every language/framework you use on any operating system. On PHP, you can use the getenv function. Check it out the Wikipedia page on Environment Variables to know how to proceed on your system.

提交回复
热议问题