Is this JavaScript code correct?

Hi,

I’m not a coder (no-coder :slight_smile: ) and struggling to get a google ads conversion firing on button submit.

I have this Javascript code in the workflow:
gtag_report_conversion()

Is this code correct to make fire a trigger and make conversion count? Is this show you call a function in JS?

If yes why then do I get this in Console:

Uncaught ReferenceError: gtag_report_conversion is not defined
at eval (eval at (PLUGIN_Toolbox-action–Run-javascript-.js:1), :1:1)
at eval (PLUGIN_Toolbox-action–Run-javascript-.js:3)

  • Seems to me that I need to define what this function does, but I’ve noidea how to do that or why should I do that since this was not in Google support instructions onhow to install this conversion trigger.

Thanks,

1 Like

Hi @samir.pekaz

Yes assumedly the function is defined in a library that should be included in the header section of your page.

Can you take some screenshots of where you included any other scripts provided by Google for this purpose?

Also can you provide a link to the instructions from Google in terms of how to set this up.

Hi @robhblake Rob,
I’ve posted on the same issue elsewhere but in more general terms (what am I doing wrong). I can’t find google’s instructions now where they say to use that JS code:gtag_report_conversion(), but it’s somewhere in their docs, I wouldn’t know to do that myself. Here is what I wrote in other post with screenshots:

I’ve been reading through the forum on this but not much is written really on how to trigger an event from bubble app.

I need my Submit button to trigger a conversion in Google ads.

So I have placed Google tag manager scripts in the head and body in bubble settings. Google tag assistant is reading Tag Manager tag correctly, so it’s there.

I’ve set up conversion to track form submission in Google Ads and created Tag and trigger for it (I’m using Google Tag manager and G4 analytics now while having old GA UA installed as well, Conversion LInker and Google Ads Conversion Tracking Tags are added). The conversion is not being verified, I tried many times to trigger it manually.

On button Submit I trigger a JS in the workflow with code:
gtag_report_conversion()

I’m not a developer and I’m actually not sure if that should do it, according to Google instructions it should, as I copied code from there. HELP!?? :slight_smile:

This is what I get in the console of app when inspected in the browser:

Uncaught ReferenceError: gtag_report_conversion is not defined
at eval (eval at (PLUGIN_Toolbox-action–Run-javascript-.js:1), :1:1)
at eval (PLUGIN_Toolbox-action–Run-javascript-.js:3)

screenshots:


You’d need some kind of onclick listener right? That would trigger the script.

I think that would be the case if you are not using Google Tag manager, but if you would be installing the conversion “yourself” as in the screenshots:

To solve this I ended up using Element visibility trigger ing GTM. Essentially you find ID of bubble element and place that as a requirement within your trigger (in GTM). Now when the user submits a form, the pop-up Thank is shown, and that is used as a trigger to fire the tag.

Conversion is verified and works correctly! Yey

This topic was automatically closed after 70 days. New replies are no longer allowed.