3

I want to track button clicks, which lead to external website. I want to put them in Google Analytics Goals.

Is there any option to this without Google Tag Manager?

Stefan Zobel
  • 3,182
  • 7
  • 28
  • 38

2 Answers2

0

You can include a separate .js file that listens for all link clicks on your website. Whenever a link click occurs check if the hostname matches your website. If not use the global ga() object (If you have added the analytics.js library snippet in your site) and send an event to google Analytics. The command will look like the one below

ga('send', 'event', 'outbound link', '{link text} - {link href}');

where {link text} is the text of the link and {link href} is the href that the link points to.

Igneel64
  • 618
  • 4
  • 10
-3

Rather than write a bunch of extra code, you can follow this guide. Pretty simple. Your link text could be (most likely will be) different throughout your entire website. GTM will simply track every single click and report on it.

http://mediacause.org/track-button-clicks-google-tag-manager/

Millhorn
  • 2,953
  • 7
  • 39
  • 77