My question is about how dataLayer.push(obj) effects performance in Angular SPA application.
In SignUpComponent there is a method showPopup()
SignUpComponent:
export class SignUpComponent implements OnInit { popupIsVisible: boolean = false; constructor() {} showPopup() { window['dataLayer'].push({ RegistrationType: 'RMG', event: 'OpenRegPopup', }); this.popupIsVisible = true; } } The thing is when I call window['dataLayer'].push before this.popupIsVisible = true, animation when popup is showing is a little-bit laggy and choppy, but if I remove window['dataLayer'].push animation is clear and smooth.
I have added javascripts for google tag manager in the index.html like their docs are saying link1 link2.
I have no idea what causes this choppy animations when calling window['dataLayer'].push, is there something that I may have missed? or any possible solutions?
Is it a good practice for example if I call window['dataLayer'].push asynchronously, or maybe calling them from web workers?
没有评论:
发表评论