Skip to main content

Hi folks,


I have a custom-built React form on my Unbounce page, and am trying to fire an Unbounce conversion when the form is completed.


Is there any undocumented function or hack I can use to make this happen?


Here’s what I’ve tried so far:




  • Use external tracking: This won’t work, because we’re on the actual Unbounce page. I could load up a hidden iFrame with the conversion code on it, but this seems hacky/unreliable, and will probably break down depending on cookie settings.




  • Use some JS to add an iFrame to the page that loads up a page, as per this gist. This gives me a console error of: “Cannot read property ‘afterFormSubmit’ of undefined” (to be fair, this was an ancient suggestion).




  • Finally, I was able to trigger a conversion by following a button with the destination “clkg/” in front of the URL. This seems like it could be a springboard - if I can simulate this in JS, we could get somewhere…



Hey Harvey,


Have you tried loading the conversion script into a Google Tag Manager tag and firing it from there?


Depending on the config of the form you may have to play with different triggers to see what works, i.e. a form submission trigger triggers vs. an element visibility trigger etc.


Hey @jboyski, yes, I’ve tried firing the external tracking script from Google Tag Manager.


My understanding is this script isn’t intended to work on the actual Unbounce page, although I may be mistaken.


The tag is definitely firing (I’m console logging to prove this), perhaps you could expand on your last para?


All the best,


Hey Harvey,


My understanding is that the conversion tracking script when fired looks back to find the last known page you visited on the Unbounce domain.


In theory, if you use something like a page unload trigger the script would still identify the last page as the one you’re exiting.


Simo Ahava has a good blog post on this particular event type: https://www.simoahava.com/analytics/fire-trigger-when-user-about-to-leave-page/


I haven’t personally tested this, so maybe check with Unbounce support whether the script can be fired this way.


Reply