Skip to content
This repository has been archived by the owner on Nov 7, 2022. It is now read-only.

Commit

Permalink
Update GA event label
Browse files Browse the repository at this point in the history
  • Loading branch information
grega committed Sep 9, 2020
1 parent 9634d99 commit 905bc8d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions components/ways-to-run/Hero.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,25 @@ export default {
components: {
VideoModal,
},
mounted() {
trackLinks();
},
};
function trackLinks() {
const trackedLinks = document.querySelectorAll("a[data-action]");
for (let trackedLink of trackedLinks) {
let data = trackedLink.dataset;
if (data.action !== "click") {
continue;
}
trackedLink.addEventListener(data.action, () =>
ga("send", "event", data.category, data.action, data.label)
);
}
}
</script>
<style lang="scss" scoped>
@import "~/assets/_variables.scss";
Expand Down
2 changes: 1 addition & 1 deletion components/ways-to-run/Sessions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
</div>
</div>
<div class="c-sessions__cta">
<p><a class="c-button c-button--orange" href="https://static.raspberrypi.org/files/clubs/Guidance_on_remote_activities.pdf" data-action="click" data-label="Remote activities planning checklist" data-category="Ways to Run Downloads">Guidance on remote activites</a></p>
<p><a class="c-button c-button--orange" href="https://static.raspberrypi.org/files/clubs/Guidance_on_remote_activities.pdf" data-action="click" data-label="Guidance on remote activities" data-category="Ways to Run Downloads">Guidance on remote activites</a></p>
</div>

<hr />
Expand Down

0 comments on commit 905bc8d

Please sign in to comment.