mzuccaroli / angular-google-tag-manager

A service library for integrate google tag manager in your angular project
https://itnext.io/how-to-add-google-tag-manager-to-an-angular-application-fc68624386e2
MIT License
136 stars 78 forks source link

Null-Like GTM-ID should not throw an error #158

Closed ma7moudat closed 1 year ago

ma7moudat commented 1 year ago

Background:

This doesn't make much sense, since GTM is not a crucial piece of code and the project should be able to run without it. Kind of an opt-in feature.

This means, when the settings are not valid, an error should not be thrown; maybe just a console warning instead hinting to the facts that tags can't be pushed.

AElmoznino commented 1 year ago

Struggling with the same issue here, +1!

cmalard commented 1 year ago

works fine with empty string ;-) BUT the tags will still be fired (and will respond with an HTTP 400 😂 👌)

Would be awesome to still have the Angular service (to not break existing calls) but not load the google-tag-manager lib nor trigger the API calls 🙇 In the meantime, we added checks to see if this.gtmService.googleTagManagerId is valid to trigger or not the pushTag

pm20390 commented 1 year ago

Hey there, can you check out if the PR fixes this? We had a similar issue and this was a good solution.