How to Add Google Ads Tag on Button Click for Conversion Tracking
How to Add Google Ads Tag on Button Click for Conversion Tracking
At a glance
The community member wants to add a Google Ads tag to fire a conversion on a button click. Another community member suggests adding a JavaScript snippet to the form submission success event in a hidden HTML embed. The community member provides the code snippet and asks for an example. After some back-and-forth, the community member reports that the solution worked, but they had to use the page load code snippet instead of the click event snippet.
Paste it in between the <head></head> tags of the page(s) you'd like to track, right after the Google tag.
Call gtag_report_conversion when someone clicks on the chosen link or button.
<!-- Event snippet for Submit Form conversion page In your html page, add the snippet and call gtag_report_conversion when someone clicks on the chosen link or button. --> <script> function gtag_report_conversion(url) { var callback = function () { if (typeof(url) != 'undefined') { window.location = url; } }; gtag('event', 'conversion', { 'send_to': 'AW-***', 'event_callback': callback }); return false; } </script>
I was using the click even code snippet above when i should of used the page load code snippet and now it working fine
Add a reply
Sign up and join the conversation on Discord
","dateCreated":"2025-01-09T09:17:34.665Z","dateModified":"2025-01-09T09:20:50.802Z","author":{"@type":"Person","url":"https://help.webstudio.is/members/17cee888-fe3f-4838-b5aa-fbcb50e92ad3","name":"Emmanuel","identifier":"17cee888-fe3f-4838-b5aa-fbcb50e92ad3","image":"https://cdn.discordapp.com/embed/avatars/0.png"},"commentCount":0,"comment":[],"position":3,"upvoteCount":0},{"@type":"Comment","text":"Are you saying just add this snippet in an hidden html embed on success ?","dateCreated":"2025-01-09T09:18:00.538Z","dateModified":"2025-01-09T09:18:00.538Z","author":{"@type":"Person","url":"https://help.webstudio.is/members/17cee888-fe3f-4838-b5aa-fbcb50e92ad3","name":"Emmanuel","identifier":"17cee888-fe3f-4838-b5aa-fbcb50e92ad3","image":"https://cdn.discordapp.com/embed/avatars/0.png"},"commentCount":0,"comment":[],"position":4,"upvoteCount":0},{"@type":"Comment","text":"Yes","dateCreated":"2025-01-09T13:32:05.394Z","dateModified":"2025-01-09T13:32:05.394Z","author":{"@type":"Person","url":"https://help.webstudio.is/members/a3a85f00-1132-4262-8176-1ff92ab9d883","name":"John Siciliano","identifier":"a3a85f00-1132-4262-8176-1ff92ab9d883","image":"https://cdn.discordapp.com/avatars/1141467296532009071/8c83067a661d2916bfb8be5a37677463.webp?size=256"},"commentCount":0,"comment":[],"position":5,"upvoteCount":0},{"@type":"Comment","text":"Thanks John, will try this out","dateCreated":"2025-01-09T18:56:59.123Z","dateModified":"2025-01-09T18:56:59.123Z","author":{"@type":"Person","url":"https://help.webstudio.is/members/17cee888-fe3f-4838-b5aa-fbcb50e92ad3","name":"Emmanuel","identifier":"17cee888-fe3f-4838-b5aa-fbcb50e92ad3","image":"https://cdn.discordapp.com/embed/avatars/0.png"},"commentCount":0,"comment":[],"position":6,"upvoteCount":0},{"@type":"Comment","text":"This didnt work","dateCreated":"2025-01-09T19:10:24.197Z","dateModified":"2025-01-09T19:10:24.197Z","author":{"@type":"Person","url":"https://help.webstudio.is/members/17cee888-fe3f-4838-b5aa-fbcb50e92ad3","name":"Emmanuel","identifier":"17cee888-fe3f-4838-b5aa-fbcb50e92ad3","image":"https://cdn.discordapp.com/embed/avatars/0.png"},"commentCount":0,"comment":[],"position":7,"upvoteCount":0},{"@type":"Comment","text":"Webhook forms don't submit in the builder, so did you try it on the live site?","dateCreated":"2025-01-09T19:20:45.477Z","dateModified":"2025-01-09T19:20:45.477Z","author":{"@type":"Person","url":"https://help.webstudio.is/members/a3a85f00-1132-4262-8176-1ff92ab9d883","name":"John Siciliano","identifier":"a3a85f00-1132-4262-8176-1ff92ab9d883","image":"https://cdn.discordapp.com/avatars/1141467296532009071/8c83067a661d2916bfb8be5a37677463.webp?size=256"},"commentCount":0,"comment":[],"position":8,"upvoteCount":0},{"@type":"Comment","text":"Yes its working now thank you for the help bro","dateCreated":"2025-01-09T19:21:13.055Z","dateModified":"2025-01-09T19:21:13.055Z","author":{"@type":"Person","url":"https://help.webstudio.is/members/17cee888-fe3f-4838-b5aa-fbcb50e92ad3","name":"Emmanuel","identifier":"17cee888-fe3f-4838-b5aa-fbcb50e92ad3","image":"https://cdn.discordapp.com/embed/avatars/0.png"},"commentCount":0,"comment":[],"position":9,"upvoteCount":0},{"@type":"Comment","text":"I was using the click even code snippet above when i should of used the page load code snippet and now it working fine","dateCreated":"2025-01-09T19:22:33.144Z","dateModified":"2025-01-09T19:22:33.144Z","author":{"@type":"Person","url":"https://help.webstudio.is/members/17cee888-fe3f-4838-b5aa-fbcb50e92ad3","name":"Emmanuel","identifier":"17cee888-fe3f-4838-b5aa-fbcb50e92ad3","image":"https://cdn.discordapp.com/embed/avatars/0.png"},"commentCount":0,"comment":[],"position":10,"upvoteCount":0}],"author":{"@type":"Person","url":"https://help.webstudio.is/members/17cee888-fe3f-4838-b5aa-fbcb50e92ad3","name":"Emmanuel","identifier":"17cee888-fe3f-4838-b5aa-fbcb50e92ad3","image":"https://cdn.discordapp.com/embed/avatars/0.png"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0}}]