Expand my Community achievements bar.

Help shape the future of AI assistance by participating in this quick card sorting activity. Your input will help create a more effective system that better serves your needs and those of your colleagues.
SOLVED

Has anyone had any experience implementing a Google AdWords Conversion Tag on click of a link or button using DTM?

Avatar

Level 3

I’m trying to throw a tag on click of a button (due to the way the experience is built, this is my only option…) to capture registrations.  I'm not sure how to create the on-click event in DTM.  Below is the code and full instructions from Google.  Any guidance or help pointing me in the right direction would be HUGELY appreciated.

Thanks!

----

Below is the Google AdWords Conversion Tracking code for conversion action Quick Registration. For the tracking to work, you'll need to make sure you include both the code snippet and the appropriate 'onClick' tags from one of our examples. This tells AdWords to record a conversion only when a customer clicks on a specific phone number. If you don't include an 'onClick' tag in your HTML, no conversions will be registered.

For examples see https://support.google.com/adwords/answer/86276?&hl=en_US.

<!-- Google Code for Quick Registration Conversion Page In your html page, add the snippet and call goog_report_conversion when someone clicks on the chosen link or button. -->

<script type="text/javascript">

   /* <![CDATA[ */

   goog_snippet_vars = function() {

     var w = window;

     w.google_conversion_id = 933120834;

     w.google_conversion_label = "N65LCNWl82IQwpb5vAM";

     w.google_remarketing_only = false;

   }

   // DO NOT CHANGE THE CODE BELOW.

   goog_report_conversion = function(url) {

     goog_snippet_vars();

     window.google_conversion_format = "3";

     var opt = new Object();

     opt.onload_callback = function() {

     if (typeof(url) != 'undefined') {

       window.location = url;

     }

   }

   var conv_handler = window['google_trackConversion'];

   if (typeof(conv_handler) == 'function') {

     conv_handler(opt);

   }

}

/* ]]> */

</script>

<script type="text/javascript"

   src="//www.googleadservices.com/pagead/conversion_async.js">

</script>

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Randy, 

Please create the event based rule for the onclick event on Quick Registration  action. There is no need to enter the custom code in the Adobe Analytics  section of the event based rule . Please add the below code in Javascript / Third party Tag section of Event based rule as "Sequential Javascript" .

<script type="text/javascript"> /* <![CDATA[ */ goog_snippet_vars = function() { var w = window; w.google_conversion_id = 933120834; w.google_conversion_label = "N65LCNWl82IQwpb5vAM"; w.google_remarketing_only = false; } // DO NOT CHANGE THE CODE BELOW. goog_report_conversion = function(url) { goog_snippet_vars(); window.google_conversion_format = "3"; var opt = new Object(); opt.onload_callback = function() { if (typeof(url) != 'undefined') { window.location = url; } } var conv_handler = window['google_trackConversion']; if (typeof(conv_handler) == 'function') { conv_handler(opt); } } /* ]]> */ </script> <script type="text/javascript" src="//www.googleadservices.com/pagead/conversion_async.js"> </script>

Please do let us know if any help is required with the "Condtions" section of event based rule.

Thanks & Regards

Parit Mittal

View solution in original post

3 Replies

Avatar

Level 9

Hi Randy,

You can accomplish this with an event based rule on the click and then add the extra code in the javascript section at the bottom of the rule. There is a video for creating event based rules here: https://outv.omniture.com?v=t1aTY4ZzrSWZE4iueJ54dLXMDI_Znldy. The documentation for event based rules is here: https://marketing.adobe.com/resources/help/en_US/dtm/rules_event.html.

Let me know if that doesn't work.

-Tacia

Avatar

Level 3

Hi Tacia,

Thanks for the response, but this doesn't fully answer my question.  The above implementation appears to require custom code, and I'm not exactly sure what that should look like.  On Click of the link, I need to make sure that goog_report_conversion is called.  Any idea what that should look like in the code?  Obviously, I'm not a coder.  :-(

Thanks!

Avatar

Correct answer by
Level 10

Hi Randy, 

Please create the event based rule for the onclick event on Quick Registration  action. There is no need to enter the custom code in the Adobe Analytics  section of the event based rule . Please add the below code in Javascript / Third party Tag section of Event based rule as "Sequential Javascript" .

<script type="text/javascript"> /* <![CDATA[ */ goog_snippet_vars = function() { var w = window; w.google_conversion_id = 933120834; w.google_conversion_label = "N65LCNWl82IQwpb5vAM"; w.google_remarketing_only = false; } // DO NOT CHANGE THE CODE BELOW. goog_report_conversion = function(url) { goog_snippet_vars(); window.google_conversion_format = "3"; var opt = new Object(); opt.onload_callback = function() { if (typeof(url) != 'undefined') { window.location = url; } } var conv_handler = window['google_trackConversion']; if (typeof(conv_handler) == 'function') { conv_handler(opt); } } /* ]]> */ </script> <script type="text/javascript" src="//www.googleadservices.com/pagead/conversion_async.js"> </script>

Please do let us know if any help is required with the "Condtions" section of event based rule.

Thanks & Regards

Parit Mittal