From cf6b6c0c73381a3af658c0dc93007990ace305cf Mon Sep 17 00:00:00 2001 From: Ludovic DEHON Date: Mon, 11 Sep 2023 13:09:42 +0200 Subject: [PATCH] feat(site): properly track page view in hubspot --- plugins/hubspot.client.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/hubspot.client.js b/plugins/hubspot.client.js index 9e7d7bb81e..c22dde86b3 100644 --- a/plugins/hubspot.client.js +++ b/plugins/hubspot.client.js @@ -1,5 +1,11 @@ export default defineNuxtPlugin((nuxtApp) => { nuxtApp.hook('page:finish', () => { + const route = useRoute() + + let _hsq = window._hsq = window._hsq || []; + _hsq.push(['setPath', route.path]); + _hsq.push(['trackPageView']); + if (window?.HubSpotConversations?.widget) { window.HubSpotConversations.widget.refresh() }