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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use defer instead of async #88

Open
hurifajri opened this issue Apr 29, 2021 · 2 comments
Open

How to use defer instead of async #88

hurifajri opened this issue Apr 29, 2021 · 2 comments

Comments

@hurifajri
Copy link

Does this module automatically set the script to use async attribute?
How can I change to defer?

@tomekrozalski
Copy link

We can use setTimeout, but I am not sure is it good idea 🤔

setTimeout(() => {
  TagManager.initialize({ gtmId: process.env.NEXT_PUBLIC_GTM_ID });
}, 4000);

@mahmoudadly-cobalt
Copy link

You can instead install react-gtm-module-defer and then in your code import TagManager from 'react-gtm-module-defer'. That will change async to defer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants