- HubSpot Community
- HubSpot Developers
- Re: pop-up form (not) triggering in single page application
APIs & Integrations
Search APIs & Integrations for solutions or ask a question
Turn on suggestions Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for
Search instead for
Did you mean:
Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
ccon
Feb 14, 20239:09 PM
Member
pop-up form (not) triggering in single page application
SOLVE
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
Solved!Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Starter
1Upvote
1 Accepted solution
Solution
baribeau
4 weeks ago
Contributor
pop-up form (not) triggering in single page application
SOLVE
I've outlined a slightly-hacky solution for this problem using Google Tag Manager and Javascript, athttps://community.hubspot.com/t5/APIs-Integrations/Force-CTA-Scripts-to-Run-on-History-Change-for-si...
View solution in original post
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
0Upvotes
- View all posts
- Previous post
- Next post
7 Replies 7
Solution
baribeau
4 weeks ago
Contributor
pop-up form (not) triggering in single page application
SOLVE
I've outlined a slightly-hacky solution for this problem using Google Tag Manager and Javascript, athttps://community.hubspot.com/t5/APIs-Integrations/Force-CTA-Scripts-to-Run-on-History-Change-for-si...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
0Upvotes
baribeau
Nov 15, 202312:16 PM - edited Nov 15, 202312:29 PM
Contributor
pop-up form (not) triggering in single page application
SOLVE
Links to similar/identical issues, with slightly different descriptions or angles of approach:
- https://community.hubspot.com/t5/APIs-Integrations/Force-CTA-Scripts-to-Run-on-History-Change-for-si...
- https://community.hubspot.com/t5/APIs-Integrations/When-we-change-the-route-in-our-React-single-page...
- https://community.hubspot.com/t5/APIs-Integrations/Tracking-code-problem-in-Angular-Site/m-p/360261
- https://community.hubspot.com/t5/HubSpot-Ideas/Support-Single-Page-Application-navigation-logic-in-C...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
0Upvotes
Jaycee_Lewis
Feb 15, 20232:01 PM
Community Manager
pop-up form (not) triggering in single page application
SOLVE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
0Upvotes
MatthiasWeber
Feb 16, 20233:02 PM
Top Contributor | Partner
pop-up form (not) triggering in single page application
SOLVE
Complicated to say without review. Maybe you can have a look if you implemented both push correctly?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2Upvotes
ccon
Feb 16, 20235:47 PM - edited Feb 16, 20235:54 PM
Member
pop-up form (not) triggering in single page application
SOLVE
@Jaycee_Lewis@MatthiasWeberthanks 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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
0Upvotes
MatthiasWeber
Feb 17, 20232:15 AM
Top Contributor | Partner
pop-up form (not) triggering in single page application
SOLVE
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_Lewiscan ask internally.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
1Upvote
ccon
Feb 19, 20233:21 PM
Member
pop-up form (not) triggering in single page application
SOLVE
@MatthiasWeberappreciate you taking a look at this; thanks!
@Jaycee_Lewis,any further insight would be great, if possible.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
0Upvotes