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 5
  • Views 2.3k
  • Created
  • Last Reply

Top Posters In This Topic

  • 2 months later...
  • 2 weeks later...

If this is for Google Ads, @LizzyDizzy @CLH  you don't have to create custom code. just use google tag manager. select google ads as the tag type and clicking the button the trigger.

Data Nerd 🧑🏾‍💻|  I help businesses transform data into actionable insights & sales | Chat with me about your website + marketing analytics challenges: TayloredData.com

Prefer video tutorials? Check out my latest marketing and web analytics how to videos

Link to comment

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.