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

  • 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

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

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
  • Print
  • Report Inappropriate Content

Starter

1Upvote

1 Accepted solution

Re: pop-up form (not) triggering in single page application (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...

View solution in original post

  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Report Inappropriate Content

0Upvotes

  • View all posts
  • Previous post
  • Next post

7 Replies 7

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

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
  • Print
  • Report Inappropriate Content

0Upvotes

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

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
  • Print
  • Report Inappropriate Content

0Upvotes

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

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

‎Feb 15, 20232:01 PM

Community Manager

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

SOLVE

Hi,@ccon👋 Thanks for reaching out. Hey,@tjoyce@MatthiasWeber, doyou have any experience here?

Thank you! — Jaycee

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

JayceeLewis

Developer Community Manager

Community|HubSpot

  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Report Inappropriate Content

0Upvotes

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

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

‎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
  • Print
  • Report Inappropriate Content

2Upvotes

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

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
  • Print
  • Report Inappropriate Content

0Upvotes

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

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

‎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
  • Print
  • Report Inappropriate Content

1Upvote

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

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
  • Print
  • Report Inappropriate Content

0Upvotes

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

Re: pop-up form (not) triggering in single page application (2024)
Top Articles
Latest Posts
Article information

Author: Kareem Mueller DO

Last Updated:

Views: 5542

Rating: 4.6 / 5 (46 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Kareem Mueller DO

Birthday: 1997-01-04

Address: Apt. 156 12935 Runolfsdottir Mission, Greenfort, MN 74384-6749

Phone: +16704982844747

Job: Corporate Administration Planner

Hobby: Mountain biking, Jewelry making, Stone skipping, Lacemaking, Knife making, Scrapbooking, Letterboxing

Introduction: My name is Kareem Mueller DO, I am a vivacious, super, thoughtful, excited, handsome, beautiful, combative person who loves writing and wants to share my knowledge and understanding with you.