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

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

    The solution is to use Google Tag Manager (GTM) to handle your Google Analytics. This will allow you to only fire Google Analytics on your production domain without having to write any conditionals in your site's code. Here's how to do it:

    In GTM, set a Trigger that only fires when the Page Hostname contains your production domain.

    Then set a Tag for Universal Analytics and make its Trigger the one you just created.

提交回复
热议问题