APIs & Integrations

MW-at-mims
Participant

Tracking code API

We have a problem with tracking a page view in Hubspot.

Our web pages are only tracked as <domain name>/[object Object] only, not with the proper full path. e.g. https://exampledomain.com/[object Object]

 

We are sending proper parameters as described in the tracking API page:

https://developers.hubspot.com/docs/api/events/tracking-code#tracking-in-single-page-applications 

 

However the API parameters [po] [rpo] are showing the value [object Object]. [rcu] shows the previous page URL path [pu] shows the current page URL path. How can we fix this issue?

0 Votes
1 Réponse
Jaycee_Lewis
Gestionnaire de communauté
Gestionnaire de communauté

Tracking code API

Hey, @MW-at-mims 👋 Thanks for your question. I am not an expert in this area by any means. I did a little digging through other posts for suggestions. We'll also leave this post open in case other community members have any additional suggestions for you.

 

Here are a few troubleshooting steps and suggestions:

  • Inspect Network Requests: Use your browser’s developer tools to inspect the network requests being made to HubSpot. Check the payload being sent to ensure that the parameters are being passed as strings, not objects
  • Console Logs: Add console logs before sending the data to HubSpot to see how the `po` and `rpo` values are being formatted. This can help identify if they are objects or strings.

Summary:

Make sure you’re passing `po` and `rpo` as serialized strings, not objects. In the context of an SPA, use the `window._hsq.push()` method correctly to track page views on route changes, and ensure that `setPath` is using a string value for the new path.

 

If this doesn’t solve the issue or you need further assistance, feel free to share more details!

 

Have fun building! — Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Votes