angular-google-analytics icon indicating copy to clipboard operation
angular-google-analytics copied to clipboard

Best way to prevent data being sent for specific users or situation ?

Open ervinebalo opened this issue 9 years ago • 1 comments

I am building a web app and I am the dev and the admin of the site.

During dev, I don't my browsing data to be sent to GA. Unless, of course, I am testing new tracking implementation.

Then in the production site, while administering the site, what's the best way for me to not send my growing data? I know in GA I can filter IP addresses but that won't work for me because I have users under the same network that I would like their browsing data tracked.

Thanks!

ervinebalo avatar May 13 '16 23:05 ervinebalo

Is your web app build as an SPA? The module comes with an opt-out feature and offline mode and my suggestion would be to use server side scripting to set some configuration variables. Either by adding GET variables to the page you bookmark as admin or by simply having an additional index page.

In index.html

<script>
  var optOut = true;
</script>

<!-- or with PHP -->
<script>
  var optOut = <?php echo isset($_GET['disable']) ? "true" : "false" ?>;
</script> 

In your app.js:

AnalyticsProvider.startOffline(optOut);

Toxantron avatar May 15 '16 18:05 Toxantron