Skip to content

Commit

Permalink
add gtag function
Browse files Browse the repository at this point in the history
  • Loading branch information
akariv committed Sep 17, 2024
1 parent 7082ce0 commit a018374
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,9 @@ export class MainPageComponent implements OnInit, AfterViewInit, AfterContentChe
event.selected_location = location;
}
Object.assign(event, record._event_topics);
event['event'] = 'phase';
if (window['gtag']) {
window['gtag']('event', 'phase', event);
window['gtag'](event);
}
record._reported_phases[phase] = true;
}
Expand Down
4 changes: 1 addition & 3 deletions ui/projects/businessgate/src/app/state.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ export class StateService {
addState(kind, x) {
if (!this.inState(this._current, kind, x)) {
if (window['gtag'] && kind === 'stack') {
window['gtag']('event', 'stack', {
'stack_name': x
});
window['gtag']({event: 'stack', stack_name: x});
}
return [...this._current.filter((i) => i.indexOf(kind + ':') !== 0), kind + ':' + x].join('|');
}
Expand Down
6 changes: 3 additions & 3 deletions ui/projects/businessgate/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-P448WZ2N');
window.dataLayer = window.dataLayer || [];
function gtag(){
console.log('GTAG', arguments);
window.dataLayer.push(arguments);
function gtag(i){
console.log('GTAG', i);
window.dataLayer.push(i);
}
</script>
<!-- End Google Tag Manager -->
Expand Down

0 comments on commit a018374

Please sign in to comment.