admin管理员组

文章数量:1426048

I'm using WP 5.2.2 and trying to configure a cookie notice banner. I'm using the popular Cookie Notice plugin (v1.2.46).

My problem comes that when I configure the Google Analytics script (the one to be inserted when the user accepts the use of cookies), when saving changes the code is changed from

<script async src=""></script>
<script>window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments)};gtag('js',new Date());gtag('config','UA-XXXXXXXX-X');</script>

to

<a href="">;/a>
<script>window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments)};gtag('js',new Date());gtag('config','UA-XXXXXXXX-X');</script>

Obviously it makes my site not being tracked by GA.

I've being looking around for a solution and I haven't been able to find one. Any ideas?

I'm using WP 5.2.2 and trying to configure a cookie notice banner. I'm using the popular Cookie Notice plugin (v1.2.46).

My problem comes that when I configure the Google Analytics script (the one to be inserted when the user accepts the use of cookies), when saving changes the code is changed from

<script async src="https://www.googletagmanager/gtag/js?id=UA-XXXXXXXX-X"></script>
<script>window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments)};gtag('js',new Date());gtag('config','UA-XXXXXXXX-X');</script>

to

<a href="https://www.googletagmanager/gtag/js?id=UA-XXXXXXXX-X">https://www.googletagmanager/gtag/js?id=UA-XXXXXXXX-X</a>
<script>window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments)};gtag('js',new Date());gtag('config','UA-XXXXXXXX-X');</script>

Obviously it makes my site not being tracked by GA.

I've being looking around for a solution and I haven't been able to find one. Any ideas?

Share Improve this question asked Jun 19, 2019 at 16:01 cbuchartcbuchart 1718 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

I tried to replicate the problem into a local server in order to debug the plugin and it worked flawlessly. When looking at the difference between both installations I noticed this one, related to JetPack (v7.4.1), in JP / Writing / Composing:

Compose using shortcodes to embed media from popular sites

Disabling such option the Cookie Notice plugin started to save the snippet correctly.

本文标签: plugins39ltscriptgt39 tag is changed to 39ltagt39 when configuring Cookie Notice