Commit 96848051 by Harsh Shah

GTM issue fixed - not yet tested

"HelpHero.identify expects a valid number or string as the first argument, recieved: undefined Falling back to anonymous user tracking for this session"
parent fc60ca78
......@@ -27,16 +27,13 @@ export class GoogleTagManagerService {
return window['dataLayer'];
}
private clearDataLayer() {
const window = this.browserGlobals.windowRef();
window['dataLayer'] = [{
'gtm.start': new Date().getTime(),
event: 'gtm.js'
}];
}
private pushOnDataLayer(obj: object) {
const dataLayer = this.getDataLayer();
if(obj) {
obj['gtm.start'] = new Date().getTime(),
obj['event'] = 'gtm.js'
}
dataLayer.push(obj);
}
......@@ -65,11 +62,10 @@ export class GoogleTagManagerService {
}
public pushTag(item: object) {
this.clearDataLayer();
this.pushOnDataLayer(item);
if (!this.isLoaded) {
this.addGtmToDom();
}
this.pushOnDataLayer(item);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment