APIs & Integrations

RobinSwapcard
Participant

GatsbyJS - setPath

SOLVE

Hi there,

For my showcase I'm using GatsbyJS.

I used the function setPath to update user page view as the page changement is handled by React.

Question: On page update, should I see in Network Google Console a new line ? (https://js.hs-analytics.net/analytics/1539590700000/3004554.js) I see it only once when I load the page.

How to be sure that my installation of Hubspot is well installed ?

0 Upvotes
1 Accepted solution
cbarley
Solution
HubSpot Alumni
HubSpot Alumni

GatsbyJS - setPath

SOLVE

Hi @Robin_Herzog This method should do the trick: https://developers.hubspot.com/docs/methods/tracking_code_api/set_page_path as it looks like you have so far, though that path should just update the page path - it won't inherently track the page view. You have to then call this function: https://developers.hubspot.com/docs/methods/tracking_code_api/track_page_view. Per the Set Page Path document:

"After using this function to update the path, you will need to call the trackPageView function to track the view of the current page."

View solution in original post

0 Upvotes
3 Replies 3
RobinSwapcard
Participant

GatsbyJS - setPath

SOLVE

I did a console.log(document.title) before and after the trackPageView. The correct title is shown.

cbarley
Solution
HubSpot Alumni
HubSpot Alumni

GatsbyJS - setPath

SOLVE

Hi @Robin_Herzog This method should do the trick: https://developers.hubspot.com/docs/methods/tracking_code_api/set_page_path as it looks like you have so far, though that path should just update the page path - it won't inherently track the page view. You have to then call this function: https://developers.hubspot.com/docs/methods/tracking_code_api/track_page_view. Per the Set Page Path document:

"After using this function to update the path, you will need to call the trackPageView function to track the view of the current page."

0 Upvotes
RobinSwapcard
Participant

GatsbyJS - setPath

SOLVE

Hi,

Looks page are well tracked but the meta title is not taken into account.

My visitors went on different pages but the meta title stay the same. Not on every page, but for the first one yes.

Robin

0 Upvotes