Skip to content

Commit d2cb585

Browse files
committed
Updated gtm push events
1 parent 6dcd8a2 commit d2cb585

File tree

10 files changed

+108
-14
lines changed

10 files changed

+108
-14
lines changed

components/BfDownloadFile/BfDownloadFile.vue

+10-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,16 @@ export default {
193193
this.$gtm.push({
194194
event: 'interaction_event',
195195
event_name: 'dataset_file_download',
196-
files: propOr('', 'paths', payload)
196+
files: propOr('', 'paths', payload),
197+
file_name: "",
198+
file_path: "",
199+
file_type: "",
200+
category: "",
201+
dataset_id: "",
202+
version_id: "",
203+
doi: "",
204+
citation_type: "",
205+
location: ""
197206
})
198207
this.closeConfirmDownload()
199208
},

components/CitationDetails/CitationDetails.vue

+9-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,15 @@ export default {
138138
event: 'interaction_event',
139139
event_name: 'copy_citation_button_click',
140140
dataset_id: this.$route.params.datasetId,
141-
citation_type: citationType.label
141+
citation_type: citationType.label,
142+
category: "",
143+
version_id: "",
144+
doi: "",
145+
location: "",
146+
files: "",
147+
file_name: "",
148+
file_path: "",
149+
file_type: "",
142150
})
143151
this.$message(
144152
successMessage(

components/DatasetDetails/DatasetActionBox.vue

+10-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,16 @@ export default {
172172
this.$gtm.push({
173173
event: 'interaction_event',
174174
event_name: 'sds_viewer_button_click',
175-
button_location: 'dataset_action_box'
175+
location: 'dataset_action_box',
176+
category: "",
177+
dataset_id: propOr('', 'id', this.datasetInfo),
178+
version_id: propOr('', 'version', this.datasetInfo),
179+
doi: propOr('', 'doi', this.datasetInfo),
180+
citation_type: "",
181+
files: "",
182+
file_name: "",
183+
file_path: "",
184+
file_type: "",
176185
})
177186
},
178187
/**

components/DatasetDetails/DatasetFilesInfo.vue

+19-3
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,16 @@ export default {
306306
this.$gtm.push({
307307
event: 'interaction_event',
308308
event_name: 'sds_viewer_button_click',
309-
button_location: 'files_tab'
309+
location: 'files_tab',
310+
category: "",
311+
dataset_id: propOr('', 'id', this.datasetInfo),
312+
version_id: propOr('', 'version', this.datasetInfo),
313+
doi: propOr('', 'doi', this.datasetInfo),
314+
citation_type: "",
315+
files: "",
316+
file_name: "",
317+
file_path: "",
318+
file_type: "",
310319
})
311320
},
312321
agreementLoaded(id) {
@@ -346,8 +355,15 @@ export default {
346355
event: 'interaction_event',
347356
event_name: 'download_full_dataset',
348357
dataset_id: this.datasetId,
349-
version_id: propOr('undefined', 'version', this.datasetInfo),
350-
doi: propOr('undefined', 'doi', this.datasetInfo)
358+
version_id: propOr('', 'version', this.datasetInfo),
359+
doi: propOr('', 'doi', this.datasetInfo),
360+
location: "",
361+
category: "",
362+
citation_type: "",
363+
files: "",
364+
file_name: "",
365+
file_path: "",
366+
file_type: "",
351367
})
352368
}
353369
}

components/FilesTable/FilesTable.vue

+17-1
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,13 @@ export default {
628628
file_name: pathOr('', ['row','name'], scope),
629629
file_path: pathOr('', ['row','path'], scope),
630630
file_type: pathOr('', ['row','fileType'], scope),
631+
location: "",
632+
category: "",
633+
dataset_id: "",
634+
version_id: "",
635+
doi: "",
636+
citation_type: "",
637+
files: ""
631638
})
632639
this.getViewFileUrl(scope).then(response => {
633640
window.open(response, '_blank')
@@ -654,7 +661,16 @@ export default {
654661
this.$gtm.push({
655662
event: 'interaction_event',
656663
event_name: 'dataset_file_download',
657-
files: propOr('', 'paths', payload)
664+
files: propOr('', 'paths', payload),
665+
file_name: "",
666+
file_path: "",
667+
file_type: "",
668+
location: "",
669+
category: "",
670+
dataset_id: "",
671+
version_id: "",
672+
doi: "",
673+
citation_type: ""
658674
})
659675
},
660676

components/header/Header.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
>
8282
<nuxt-link
8383
:to="link.href"
84-
:class="{ active: activeLink(link.title) }"
84+
:class="{ active: activeLink(link.href) }"
8585
exact-active-class="active"
8686
>
8787
{{ link.displayTitle }}

middleware/clearDatalayer.js

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
export default function ({ app }) {
2+
if (app != undefined && app.$gtm != undefined) {
3+
app.$gtm.push({
4+
event: '',
5+
event_name: '',
6+
category: "",
7+
files: "",
8+
file_name: "",
9+
file_path: "",
10+
file_type: "",
11+
location: "",
12+
dataset_id: "",
13+
version_id: "",
14+
doi: "",
15+
citation_type: ""
16+
})
17+
}
18+
}

nuxt.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ const config = {
149149
component: '@/pages/datasets/_datasetId.vue'
150150
})
151151
},
152-
middleware: ['documentationHubRedirects', 'signOutRedirect']
152+
middleware: ['documentationHubRedirects', 'signOutRedirect', 'clearDatalayer']
153153
},
154154
/*
155155
** Global CSS

pages/data/index.vue

+12-3
Original file line numberDiff line numberDiff line change
@@ -467,9 +467,18 @@ export default {
467467
}
468468
const category = searchTypes.find(searchType => searchType.type == this.$route.query.type)
469469
this.$gtm.push({
470-
event: 'interaction_event',
471-
event_name: 'data_page_view',
472-
category: propOr('Datasets', 'label', category)
470+
event: "",
471+
event_name: '',
472+
category: propOr('Datasets', 'label', category),
473+
files: "",
474+
file_name: "",
475+
file_path: "",
476+
file_type: "",
477+
location: "",
478+
dataset_id: "",
479+
version_id: "",
480+
doi: "",
481+
citation_type: ""
473482
})
474483
},
475484
immediate: true

pages/datasets/_datasetId.vue

+11-2
Original file line numberDiff line numberDiff line change
@@ -369,9 +369,18 @@ export default {
369369
370370
mounted() {
371371
this.$gtm.push({
372+
event: "",
373+
category: "",
372374
dataset_id: propOr(this.$route.params.datasetId, 'id', this.datasetInfo),
373-
version_id: propOr('undefined', 'version', this.datasetInfo),
374-
doi: propOr('undefined', 'doi', this.datasetInfo)
375+
version_id: propOr('', 'version', this.datasetInfo),
376+
doi: propOr('', 'doi', this.datasetInfo),
377+
event_name: "",
378+
citation_type: "",
379+
location: "",
380+
files: "",
381+
file_name: "",
382+
file_path: "",
383+
file_type: "",
375384
})
376385
},
377386

0 commit comments

Comments
 (0)