Automattic / Automattic/jetpack

Conflict with dfactory cookie notice plugin - async script disabled

Open
#16,720 8 comments 0 reactions 0 assignees View on GitHub
[Feature] Shortcodes / Embeds [Pri] Normal Bug
Dominant language
PHP
Stars
1.8k
Forks
898
Avg merge
1d 18h
Merged PRs (30d)
774

Description

#### Steps to reproduce the issue

1. Install and activate Jetpack and the dfactory cookie notice plugin (https://dfactory.eu/docs/cookie-notice/) on wordpress.org hosting
2. Configure the Cookie notice plugin to run a google analytics script on acceptance of cookies by pasting the relevant code into the script blocking section.
3. Save and see that the script is changed so that cookies will not be activated.
4. Repeat steps 2 and 3 with the Jetpack plugin disabled and see that the script does not change on save.

#### What I expected
I expected the script (like this) to be saved correctly:

****

window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'Google Analytics ID');

#### What happened instead

Instead the first async scirpt line is replaced with an href like this

**https://www.googletagmanager.com/gtag/js?id=UA-115958247-1**

See also here where I raised the issue in the forums - I'm not the first person to see this and it is easily reproduced:

https://wordpress.org/support/topic/jetpack-conflict-with-cookie-notice-plugin/#post-13206867

Contributor guide

Open the contributing guide

Research direction

Reproduce the conflict by saving the Google Analytics script with Jetpack and the dfactory Cookie Notice plugin enabled, then compare the saved output with Jetpack disabled. Trace the Jetpack-related save or sanitization path responsible for changing the async script, and consider the issue done when the script is preserved correctly without breaking the reported plugin behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.