AdWords Conversion Tracking

, , ,

So I ran into an issue where I needed to be able to track conversions in Google AdWords for forms that were using Gravity Forms.  While this example talks about how to do this you could really use this with any form submission to thank you page or confirmation message.  As long as the confirmation message has the ability to output from a shortcode.  All of these go into your theme's functions.php file which should be a child theme if it isn't a custom developed theme.

This first bit of code is the global site tag assignment.

This second piece of code is what generates the shortcode to which you can put either in the confirmation message of the gravity form or within the content of the thank you page.

If you didn't want to go through and edit all the thank you pages you may have you could build a function like this to output the code on specified page ID's.

In reality this could be used for Google Analytics event firing or any other time you need to output code to a thank you page or confirmation message.  Maybe I will also think of a way to utilize the gform_confirmation filter but for now this way will work as you would need to write the code in such a way as to check what confirmation was being used.  This could be set to redirect or be just the message that will be getting displayed and then the redirect could be to a local page or could be a page on another site.

Skills

Posted on

January 26, 2018

Submit a Comment

Your email address will not be published. Required fields are marked *