pop-up form (not) triggering in single page application

Hi all,

I have set up a pop-up form to trigger on website URL matching one of two values. The website is a single-page-application (gatsbyjs).
When the first loaded URL matches the trigger, the form pops up, no issues whatsoever. However, when the first loaded URL does not match the trigger, and I navigate to a URL that does, the form doesn’t pop.
I have implemented the tracking for single page application (Tracking code API overview (hubspot.com).
Any idea if this is supported/should work, and how I could debug?

Thanks,

CHris

Hi, @ccon :waving_hand: Thanks for reaching out. Hey, @tjoyce @MatthiasWeber, do you have any experience here?

Thank you! — Jaycee

Complicated to say without review. Maybe you can have a look if you implemented both push correctly?

@Jaycee_Lewis @MatthiasWeber thanks for your reply!
gatsby-browser.jsx code looks like this:

export const onClientEntry = () => {
 const _hsq = (window._hsq = window._hsq || []);
 _hsq.push(["setPath", window.location.pathname]);
};

export const onRouteUpdate = ({ location, prevLocation }) => {
 const _hsq = (window._hsq = window._hsq || []);
 if (prevLocation) {
 _hsq.push(["setPath", location.pathname]);
 _hsq.push(["trackPageView"]);
 }
};

Basically, an initial push on page load and then on every route change. I added a couple of console.log statements to confirm code is properly running in prod with the expected values, so all looks good as far as I can tell.
My main question is if this scenario is supported (pop-up form on route change in single page app), and if those are the only two events that need to be sent. If yes, I’ll dig deeper and re-confirm the events are sent.

Thanks,

Chris

Hi Chris, I think now I’m on the the same page - sorry for the delay ;-). I rechecked your link and now I think: You are right! This is “only” for tracking - how should see the “movement” in the analytics part of hubspot. In the linked documentation there is nothing about (re-)triggering the pop-up. So I think it will not work like you wish. I’m not a hubspot employee - so maybe @Jaycee_Lewis can ask internally.

@MatthiasWeber appreciate you taking a look at this; thanks!
@Jaycee_Lewis, any further insight would be great, if possible.

Links to similar/identical issues, with slightly different descriptions or angles of approach:

I’ve outlined a slightly-hacky solution for this problem using Google Tag Manager and Javascript, at https://community.hubspot.com/t5/APIs-Integrations/Force-CTA-Scripts-to-Run-on-History-Change-for-single-page/m-p/977800/highlight/true#M73696