Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Tag Manager conflict with zone.js #34105

Closed
pshurygin opened this issue Nov 27, 2019 · 7 comments
Closed

Google Tag Manager conflict with zone.js #34105

pshurygin opened this issue Nov 27, 2019 · 7 comments
Assignees
Labels
Milestone

Comments

@pshurygin
Copy link

@pshurygin pshurygin commented Nov 27, 2019

馃悶 bug report

Affected Package

The issue is caused by package zone.js

Is this a regression?

This issue was reported and allegedly fixed back in 2017, but i'm seeing this problem again.
angular/zone.js#898
Probably something has changed with the GTM script, causing this issue to appear again.

Description

When loading Google tag manager script during runtime(after zone.js has been executed), it overrides ZoneAwarePromise with native Promise, breaking change detection.

馃敩 Minimal Reproduction

https://stackblitz.com/edit/angular-3kvxy9

Make sure to disable any adblock extension, as it may block GTM script. Also, it would possibly be required to manually disable stackblitz serviceworkers, as they are also preventing GTM script from loading.

Click page2 link => click page1 link and notice how CD is broken. Click button to trigger CD => everything is working again.

馃實 Your Environment

Angular Version:
Stackblitz repro is using angular 8.2.14, but i have actually faced this issue with latest 9.0.0-rc3 with Ivy enabled.
zone.js of version 0.9.1 and 0.10.2 are both failing.

@JiaLiPassion JiaLiPassion self-assigned this Nov 28, 2019
@ngbot ngbot bot added this to the needsTriage milestone Nov 28, 2019
@JiaLiPassion

This comment has been minimized.

Copy link
Contributor

@JiaLiPassion JiaLiPassion commented Nov 29, 2019

@pshurygin, I think this issue is because the script is loaded dynamically, did you try to load gtm script statically?
And it seems the Promise is overwrite by asksuite infochat.js, could you provide a github repo to reproduce this issue?
Thank you!

@pshurygin

This comment has been minimized.

Copy link
Author

@pshurygin pshurygin commented Nov 29, 2019

@JiaLiPassion unfortunately i cannot load this script statically, because in my case it is provided from a backend (the app i'm working on allows to inject user-provided html into the app).

I have converted stackblitz to github repo if that is what you are asking for:
https://github.com/pshurygin/zone-js-gtm-conflict

@JiaLiPassion

This comment has been minimized.

Copy link
Contributor

@JiaLiPassion JiaLiPassion commented Nov 30, 2019

@pshurygin, the github repo is not be able to run, could you create a repo with angular cli? Thank you

@pshurygin

This comment has been minimized.

Copy link
Author

@pshurygin pshurygin commented Nov 30, 2019

@JiaLiPassion I have updated the repo so that you can now simply run it using ng serve.

@JiaLiPassion JiaLiPassion mentioned this issue Nov 30, 2019
3 of 14 tasks complete
JiaLiPassion added a commit to JiaLiPassion/angular that referenced this issue Dec 1, 2019
@mhevery mhevery closed this in 539d8f0 Dec 3, 2019
mhevery added a commit that referenced this issue Dec 3, 2019
@pshurygin

This comment has been minimized.

Copy link
Author

@pshurygin pshurygin commented Dec 6, 2019

@JiaLiPassion It looks like it was not released alongside rc5. Is there a known release date for this fix?

@JiaLiPassion

This comment has been minimized.

Copy link
Contributor

@JiaLiPassion JiaLiPassion commented Dec 7, 2019

@pshurygin , I am not sure the release data, but it should be soon in the next release.

@angular-automatic-lock-bot

This comment has been minimized.

Copy link

@angular-automatic-lock-bot angular-automatic-lock-bot bot commented Jan 7, 2020

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jan 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants
You can鈥檛 perform that action at this time.