From eb8e5d932efd42c1162d9fd5a5a8ed2902f85e37 Mon Sep 17 00:00:00 2001 From: Yannick Holzenkamp Date: Mon, 20 Nov 2023 10:24:49 +0100 Subject: [PATCH] feat(gtm): add custom event for GTM service --- src/google-tag-manager.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/google-tag-manager.ts b/src/google-tag-manager.ts index 293d13f..fa6b2c5 100644 --- a/src/google-tag-manager.ts +++ b/src/google-tag-manager.ts @@ -19,8 +19,11 @@ export class BalGoogleTagManager { this.runGtmScript(settings.apiKey); } } - - // should be avoided + + /** + * @deprecated this method should not be used + * @param settings GTM settings for application + */ public loadForce(settings: GtmSettings): void { this.runGtmScript(settings.apiKey); } @@ -36,6 +39,12 @@ export class BalGoogleTagManager { } }; + public sendCustomEvent(event: any): void { + if (event) { + this.googleAnalyticsSendEvent(event); + } + } + /* eslint-disable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call */ private runGtmScript(apiKey: string): void { const w: any = window;