-
Notifications
You must be signed in to change notification settings - Fork 140
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 avoid TagManager.initialize() running many times #112
Comments
+1 I have the same issue |
@seandelaney have you found solution? |
@vanminhquangtri No solution yet |
We have the same issue. Any hacks on this? |
I'd recommend to just keep track of |
There is any solution for this bug? |
@vanminhquangtri Based on what you wrote, the useEffect(() => {
if (data.gtm_id){
TagManager.initialize({
gtmId: data.gtm_id,
});
}
}, []) // Remove data.gtm_id from the dependencies |
+1 on this. A callback function with |
Hello.
In my React component, I have to get gtm-ID from another data which change many time. Each time this data changes, my component render. And each time component renders, function TagManager.initialize runs again, this create duplicate gtm scripts (as attached).
My code:
Could you please advise me how to avoid function TagManager.initialize() to run if it already run?
Thank you.
The text was updated successfully, but these errors were encountered: