Skip to content

Commit

Permalink
Merge pull request #771 from egauzens/convert-gtm-events-to-messages
Browse files Browse the repository at this point in the history
Updated gtm push events
  • Loading branch information
egauzens authored Nov 21, 2023
2 parents 6dcd8a2 + d2cb585 commit 74480dc
Show file tree
Hide file tree
Showing 10 changed files with 108 additions and 14 deletions.
11 changes: 10 additions & 1 deletion components/BfDownloadFile/BfDownloadFile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,16 @@ export default {
this.$gtm.push({
event: 'interaction_event',
event_name: 'dataset_file_download',
files: propOr('', 'paths', payload)
files: propOr('', 'paths', payload),
file_name: "",
file_path: "",
file_type: "",
category: "",
dataset_id: "",
version_id: "",
doi: "",
citation_type: "",
location: ""
})
this.closeConfirmDownload()
},
Expand Down
10 changes: 9 additions & 1 deletion components/CitationDetails/CitationDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,15 @@ export default {
event: 'interaction_event',
event_name: 'copy_citation_button_click',
dataset_id: this.$route.params.datasetId,
citation_type: citationType.label
citation_type: citationType.label,
category: "",
version_id: "",
doi: "",
location: "",
files: "",
file_name: "",
file_path: "",
file_type: "",
})
this.$message(
successMessage(
Expand Down
11 changes: 10 additions & 1 deletion components/DatasetDetails/DatasetActionBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,16 @@ export default {
this.$gtm.push({
event: 'interaction_event',
event_name: 'sds_viewer_button_click',
button_location: 'dataset_action_box'
location: 'dataset_action_box',
category: "",
dataset_id: propOr('', 'id', this.datasetInfo),
version_id: propOr('', 'version', this.datasetInfo),
doi: propOr('', 'doi', this.datasetInfo),
citation_type: "",
files: "",
file_name: "",
file_path: "",
file_type: "",
})
},
/**
Expand Down
22 changes: 19 additions & 3 deletions components/DatasetDetails/DatasetFilesInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,16 @@ export default {
this.$gtm.push({
event: 'interaction_event',
event_name: 'sds_viewer_button_click',
button_location: 'files_tab'
location: 'files_tab',
category: "",
dataset_id: propOr('', 'id', this.datasetInfo),
version_id: propOr('', 'version', this.datasetInfo),
doi: propOr('', 'doi', this.datasetInfo),
citation_type: "",
files: "",
file_name: "",
file_path: "",
file_type: "",
})
},
agreementLoaded(id) {
Expand Down Expand Up @@ -346,8 +355,15 @@ export default {
event: 'interaction_event',
event_name: 'download_full_dataset',
dataset_id: this.datasetId,
version_id: propOr('undefined', 'version', this.datasetInfo),
doi: propOr('undefined', 'doi', this.datasetInfo)
version_id: propOr('', 'version', this.datasetInfo),
doi: propOr('', 'doi', this.datasetInfo),
location: "",
category: "",
citation_type: "",
files: "",
file_name: "",
file_path: "",
file_type: "",
})
}
}
Expand Down
18 changes: 17 additions & 1 deletion components/FilesTable/FilesTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,13 @@ export default {
file_name: pathOr('', ['row','name'], scope),
file_path: pathOr('', ['row','path'], scope),
file_type: pathOr('', ['row','fileType'], scope),
location: "",
category: "",
dataset_id: "",
version_id: "",
doi: "",
citation_type: "",
files: ""
})
this.getViewFileUrl(scope).then(response => {
window.open(response, '_blank')
Expand All @@ -654,7 +661,16 @@ export default {
this.$gtm.push({
event: 'interaction_event',
event_name: 'dataset_file_download',
files: propOr('', 'paths', payload)
files: propOr('', 'paths', payload),
file_name: "",
file_path: "",
file_type: "",
location: "",
category: "",
dataset_id: "",
version_id: "",
doi: "",
citation_type: ""
})
},
Expand Down
2 changes: 1 addition & 1 deletion components/header/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
>
<nuxt-link
:to="link.href"
:class="{ active: activeLink(link.title) }"
:class="{ active: activeLink(link.href) }"
exact-active-class="active"
>
{{ link.displayTitle }}
Expand Down
18 changes: 18 additions & 0 deletions middleware/clearDatalayer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export default function ({ app }) {
if (app != undefined && app.$gtm != undefined) {
app.$gtm.push({
event: '',
event_name: '',
category: "",
files: "",
file_name: "",
file_path: "",
file_type: "",
location: "",
dataset_id: "",
version_id: "",
doi: "",
citation_type: ""
})
}
}
2 changes: 1 addition & 1 deletion nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ const config = {
component: '@/pages/datasets/_datasetId.vue'
})
},
middleware: ['documentationHubRedirects', 'signOutRedirect']
middleware: ['documentationHubRedirects', 'signOutRedirect', 'clearDatalayer']
},
/*
** Global CSS
Expand Down
15 changes: 12 additions & 3 deletions pages/data/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -467,9 +467,18 @@ export default {
}
const category = searchTypes.find(searchType => searchType.type == this.$route.query.type)
this.$gtm.push({
event: 'interaction_event',
event_name: 'data_page_view',
category: propOr('Datasets', 'label', category)
event: "",
event_name: '',
category: propOr('Datasets', 'label', category),
files: "",
file_name: "",
file_path: "",
file_type: "",
location: "",
dataset_id: "",
version_id: "",
doi: "",
citation_type: ""
})
},
immediate: true
Expand Down
13 changes: 11 additions & 2 deletions pages/datasets/_datasetId.vue
Original file line number Diff line number Diff line change
Expand Up @@ -369,9 +369,18 @@ export default {
mounted() {
this.$gtm.push({
event: "",
category: "",
dataset_id: propOr(this.$route.params.datasetId, 'id', this.datasetInfo),
version_id: propOr('undefined', 'version', this.datasetInfo),
doi: propOr('undefined', 'doi', this.datasetInfo)
version_id: propOr('', 'version', this.datasetInfo),
doi: propOr('', 'doi', this.datasetInfo),
event_name: "",
citation_type: "",
location: "",
files: "",
file_name: "",
file_path: "",
file_type: "",
})
},
Expand Down

0 comments on commit 74480dc

Please sign in to comment.