Jump to content

Add Google Conversion Tracking Code to Header Button

Recommended Posts

Hi all,

I have set up a conversion action and trigger on Google Tag Manager to track outbound clicks made via the 'Book a Stay' button on our header.

The video I am following says that the final step is to add a piece of code to the button <a> tag to complete this, but I'm unsure how as I can't directly edit the button coding. I am assuming I need to add something in the custom code injector, but some advice on exactly what I need to do to achieve this would be great. 

Here's the code (highlighted) that needs to be added to the button: 

<a onclick="return gtag_report_conversion('http://example.com/your-link');"
href="http://example.com/your-link">Download now!</a>

Following this guide: https://support.google.com/google-ads/answer/6331304?hl=en#zippy=%2Cset-up-conversion-tracking-using-the-google-tag

Thanks in advance.

Edited by CLH
highlighting code
Link to comment
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.