The Hubspot Pageview event for SPA<\/figcaption><\/figure>\n\n\n\nThe full Hubspot tag should be loaded once, probably on the first page load, using the All Pages trigger.<\/p>\n\n\n\n
If the application doesn’t support route change, you can manually set the new path with this code:<\/p>\n\n\n\n
<script>\nvar _hsq = window._hsq = window._hsq || [];\n_hsq.push(['setPath', {{pagePath}}]);\n_hsq.push(['trackPageView']);\n<\/script><\/code><\/pre>\n\n\n\nHubspot SPA tracking without GTM<\/h2>\n\n\n\n
In the case that you’re not using GTM (seriously, what’s wrong with you?), you can still implement the Hubspot tag.<\/p>\n\n\n\n
In this case, you need to ask your developers to fire the Hubspot on each route change (or equivalent History Change).<\/p>\n\n\n\n
var _hsq = window._hsq = window._hsq || [];\n_hsq.push(['trackPageView']);<\/code><\/pre>\n\n\n\nSimilarly, the full Hubspot tag should be loaded once on the initial page load, so that consecutive events are able to fire.<\/p>\n\n\n\n
If the application doesn’t support route change, you can manually set the new path with this code:<\/p>\n\n\n\n
var _hsq = window._hsq = window._hsq || [];\n_hsq.push(['setPath', '\/#\/new-page']);\n_hsq.push(['trackPageView']);<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"Following my previous post on Single Page Application (SPA) tracking with Google Tag Manager (GTM), I also wanted to share the process for the Hubspot pixel. The Hubspot pixel is relatively smarter and is able to identify the new route and page title for new pages loaded. All it requires is triggering the Hubspot pixel […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[39,42],"tags":[],"class_list":["post-4412","post","type-post","status-publish","format-standard","hentry","category-google-tag-manager","category-hubspot"],"_links":{"self":[{"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/posts\/4412","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/comments?post=4412"}],"version-history":[{"count":3,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/posts\/4412\/revisions"}],"predecessor-version":[{"id":4803,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/posts\/4412\/revisions\/4803"}],"wp:attachment":[{"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/media?parent=4412"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/categories?post=4412"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/tags?post=4412"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}