From a6df3954ab021700c6afacc339048f1ea01ba6bd Mon Sep 17 00:00:00 2001 From: David Featherston Date: Wed, 28 Jun 2023 16:47:50 +1000 Subject: [PATCH] feat(@dpc-sdp/nuxt-ripple-analytics): update dataLayer events --- packages/nuxt-ripple-analytics/lib/index.ts | 16 +++++++++------- packages/nuxt-ripple-analytics/lib/tracker.ts | 6 ++++-- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/packages/nuxt-ripple-analytics/lib/index.ts b/packages/nuxt-ripple-analytics/lib/index.ts index c353aec52b..c0e65a28de 100644 --- a/packages/nuxt-ripple-analytics/lib/index.ts +++ b/packages/nuxt-ripple-analytics/lib/index.ts @@ -4,7 +4,7 @@ export default { 'rpl-accordion/toggleAll': () => { return (payload: any) => { trackEvent({ - event: `${payload.action}_accordion`, + event: `${payload.action}_accordion_all`, element_id: payload?.id, element_text: payload?.label, name: payload?.name, @@ -29,6 +29,7 @@ export default { return (payload: any) => { trackEvent({ event: `${payload.action}_alert`, + element_id: payload?.id, element_text: payload?.label, label: payload?.name, component: 'rpl-alert', @@ -39,11 +40,12 @@ export default { 'rpl-document/download': () => { return (payload: any) => { trackEvent({ - event: `${payload.action}_document`, + event: `file_${payload.action}`, element_text: payload?.label, file_name: payload?.label, file_extension: payload?.type, - file_url: payload?.id, + file_size: payload?.size, + link_url: payload?.id, component: 'rpl-document', platform_event: 'download' }) @@ -52,7 +54,7 @@ export default { 'rpl-form/submitted': () => { return (payload: any) => { trackEvent({ - event: `${payload.action}_form`, + event: `form_${payload.action}`, form_id: payload?.id, form_name: payload?.name, element_text: payload?.label, @@ -66,12 +68,12 @@ export default { trackEvent({ event: `form_${payload.action}_field`, label: payload?.label, - element_id: payload?.id, - form_id: payload?.contextId, form_name: payload?.contextName, + form_id: payload?.contextId, + field_id: payload?.id, type: payload?.type, value: payload?.value, - component: `rpl-form-${payload.type}`, + component: `rpl-form-${payload.field}`, platform_event: 'update' }) } diff --git a/packages/nuxt-ripple-analytics/lib/tracker.ts b/packages/nuxt-ripple-analytics/lib/tracker.ts index 9d5b21b3f9..73f293a0c1 100644 --- a/packages/nuxt-ripple-analytics/lib/tracker.ts +++ b/packages/nuxt-ripple-analytics/lib/tracker.ts @@ -7,9 +7,11 @@ export interface IRplAnalyticsEventPayload { name?: string file_name?: string file_extension?: string - file_url?: string - form_id?: string + file_size?: string + link_url?: string form_name?: string + form_id?: string + field_id?: string type?: string value?: string component?: string