3

I have added AMP Analytics (amp-analytics) to my AMP Pages like these and the hits are recorded properly on Google Analytics. The only problem is that it is counting all my development work as hits. This will really skew my readings as many people work on the development version.

Is there a way similar to that in this answer where I can make this script run only if it's in the production domain?

Sandeep C
  • 291
  • 1
  • 2
  • 14

1 Answers1

0

You can use a filter in the Analytics view settings to exclude hits from the development environment (i.e. by hostname or page path).

Michele Pisani
  • 13,567
  • 3
  • 25
  • 42
  • I was looking for a way to limit the hits from development environment being recorded at all. This can surely work as a workaround if there is no other straightforward solution. – Sandeep C Apr 21 '18 at 07:02
  • You can use the Tag Manager to manage analytics hits instead of explicit code on page, and not send hits based on hostname or page path. – Michele Pisani Apr 21 '18 at 08:04
  • 1
    Is that possible in this https://www.ampproject.org/docs/reference/components/amp-analytics? – Sandeep C Apr 21 '18 at 08:52