diff --git a/integrations/GA4/ECommerceEventConfig.js b/integrations/GA4/ECommerceEventConfig.js index 7010bb6f1d..52fb36c157 100644 --- a/integrations/GA4/ECommerceEventConfig.js +++ b/integrations/GA4/ECommerceEventConfig.js @@ -261,6 +261,11 @@ const eventNamesConfigArray = [ onlyIncludeParams: includeParams.CartShare, }, //--------- + { + src: ["group"], + dest: "join_group", + hasItem: false, + }, ]; export { diff --git a/integrations/GA4/browser.js b/integrations/GA4/browser.js index 4ec91ebb55..440fd7c216 100644 --- a/integrations/GA4/browser.js +++ b/integrations/GA4/browser.js @@ -19,6 +19,7 @@ export default class GA4 { this.sendUserId = config.sendUserId || false; this.blockPageView = config.blockPageViewEvent || false; this.extendPageViewParams = config.extendPageViewParams || false; + this.extendGroupPayload = config.extendGroupPayload || false; this.name = "GA4"; } @@ -215,4 +216,16 @@ export default class GA4 { window.gtag("event", "page_view", getPageViewProperty(pageProps)); } } + + group(rudderElement) { + const { groupId } = rudderElement.message; + const { traits } = rudderElement.message; + + getDestinationEventName(rudderElement.message.type).forEach((events) => { + this.sendGAEvent(events.dest, { + group_id: groupId, + ...(this.extendGroupPayload ? traits : {}), + }); + }); + } }