Skip to content

Commit

Permalink
feat(@dpc-sdp/nuxt-ripple-analytics): update dataLayer events
Browse files Browse the repository at this point in the history
  • Loading branch information
David Featherston committed Jun 28, 2023
1 parent e967957 commit a6df395
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
16 changes: 9 additions & 7 deletions packages/nuxt-ripple-analytics/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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',
Expand All @@ -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'
})
Expand All @@ -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,
Expand All @@ -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'
})
}
Expand Down
6 changes: 4 additions & 2 deletions packages/nuxt-ripple-analytics/lib/tracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a6df395

Please sign in to comment.