Adblocker阻止我的Angular网站(Google Analytics)

时间:2021-05-29 15:13:32

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.

一家公司告诉我,由于我依赖Google Analytics,他们无法访问我的Angular网站。阻止跟踪器和广告是他们的政策。

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.

由于我的网站完全是在Angular中制作的,其中一个依赖项实际上是谷歌分析,我想知道我是否可以以某种方式实现对打开此类Adblocker的访问者的回退。

Moreover, could I somehow disable the dependency injection when the user blocks it. The core of the problem are the dependencies angulartics

此外,当用户阻止依赖注入时,我可以以某种方式禁用依赖注入。问题的核心是依赖性angulartics

My app.js looks as follows:

我的app.js看起来如下:

angular.module('mywebsite', [
  'angulartics', 'angulartics.google.analytics',
  ]
)

and my index.html

和我的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?

我是否可以重写,如果这些脚本被阻止,它们会被作为依赖项删除?

1 个解决方案

#1


4  

Try renaming angulartics-google-analytics.min.js to angulartics-ga.min.js , it may help you.

尝试将angulartics-google-analytics.min.js重命名为angulartics-ga.min.js,它可能对您有所帮助。

#1


4  

Try renaming angulartics-google-analytics.min.js to angulartics-ga.min.js , it may help you.

尝试将angulartics-google-analytics.min.js重命名为angulartics-ga.min.js,它可能对您有所帮助。