Normally, you’d include the Google Ads click tracker as an onClick element. I’m trying to do this:
Which throws an “invalid return statement” error.
When I wrap it in a function, I get an “invalid or unexpected token” error:
Any idea how to make this work properly?
I now have the tracking event running properly, except: now when a user clicks the item in question, the event script fires, but also a dialogue of “Leave site? You’ll lose any unsaved changes.” pops up. Any idea why that might be occurring?
How did you get it to work, dealing with this now… ?
How did you get it to work, dealing with this now… ? Thanks
Just to be clear, that plug-in is not “from Bubble”. It was created by a third-party developer. Bubble does “no code”.
Interesting, and good find. I’ll test this out and see if I need to add it into my plug-in. I’ve read about something in the gtag docs where you have to manage timing issues when navigating away from the page.
Yes, I ran into exactly the same issue with a Stripe integration. Disabling / removing the handler for the
beforeunload event resolved it for me. See if adding the following to the start of your script solves the problem:
window.onbeforeunload = null
@MPB What’s the correct JS syntax that you got to work?