Tracking page visits in Single Page Application


#1

Hello,

Our website is a Single Page Application, therefore we track dynamic state change instead of simple pageview on page load.

I’ve added hubspot script to our website, that should dynamically track state changes (page view) and send identify user event with email, id, last and first name.

Even when I used setPath function (https://developers.hubspot.com/docs/methods/tracking_code_api/track_page_view), for some reason HubSpot shows page title instead of url. We have same page title through all our onboarding process, but different URLs for each step and its very important for us to track users on each step.

Please, help us to solve this problem.

Thanks.


#2

Hi @Mirielle,

Can you send me a link to a contact record in your portal that’s showing this behavior?


#3

https://app.hubspot.com/sales/3942058/contact/164051/?interaction=note

Just created a test account and went through a few steps of Onboarding, it shows Account Setup (page title) instead of path for all the steps


#4

Hi @Mirielle,

It’s expected that the pages will appear in-app as a link with the page title for the label and the visited page as the URL. I can see that even though the links all show the same title, they navigate to the correct URLs. When using the Track Page View method, the title tracked will be the current value of document.title. You’ll need to update document.title before tracking the page view, or the URLs will all show the same page title.