Currently I am working with Angular 8 and I am interested in lazily loading my Google Analytics script. I came across some documentation that mentioned globally loading scripts lazily using the script array in angular.json:
"scripts": [
"src/global-script.js",
{ "input": "src/lazy-script.js", "lazy": true },
{ "input": "src/pre-rename-script.js", "bundleName": "renamed-script" },
],
You can find more information about this on this link.
However, it seems like this method is now deprecated and there are no clear references in the new docs.
Using GTM (Google Tag Manager) has been affecting the load time of my app, so I am looking for a way to activate GTM only after my Angular app has loaded initially.
Do any of you have an example or suggestion on how to achieve this?
Thank you.