I have been informed by a company that they cannot visit my Angular-powered website since I am relying on Google Analytics. It is their policy to block Trackers and Ads.
Since my website is fully made in Angular and one of the dependencies is actually Google Analytics, I was wondering whether I could implement somehow a fallback for visitors that have this type of Adblocker turned on.
Moreover, could I somehow disable the dependency injection when the user blocks it. The core of the problem are the dependencies angulartics
My app.js looks as follows:
angular.module('mywebsite', [
'angulartics', 'angulartics.google.analytics',
]
)
and my index.html
<script src="/bower_components/angulartics/dist/angulartics.min.js"></script>
<script src="/bower_components/angulartics-google-analytics/dist/angulartics-google-analytics.min.js"></script>
Can I rewrite is such that if these scripts get blocked that they get removed as a dependency?
The majority of ad blockers have options to block Google Analytics (GA) and block attempts from the GA JavaScript library to send or retrieve data from analytics servers. Some blockers even block Google Analytics by default.
One of the best ways to prevent Google Analytics blocking is moving the GA tag to the Google Tag Manager Server container. I'm saying “best” because, with Server-Side tagging, you will have many other benefits, not only adblockers and ITP prevention.
The default setup of the adblockers won't hurt Google Analytics or Google Tag Manager. They will block only ads on the page that the user visits. But users can adjust settings and ask adblockers to remove any tracking scripts. In this case, Google Tag Manager won't work.
Google Analytics and Google Tag Manager calls are blocked by many adblockers too. This makes site owners wonder whether Google Analytics is still useful and whether its stats are accurate. The level of Google Analytics blockage varies by industry, audience, the device used and the individual website.
Try renaming angulartics-google-analytics.min.js
to angulartics-ga.min.js
, it may help you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With