Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0

How to track button clicks with Google Analytics event tracking?


5 answers to this question

Recommended Posts

  • 0

I figured out how to do this!

Instead of using a "button" block, use the "custom code" block. Add a link using html where you want the button to go:

<a href="/order-now" class="custom-button-black" onClick="ga('send', 'event', { eventCategory: 'order_now', eventAction: 'button_click', eventLabel: 'section_intro'});"
>Order Now</a>

  • The link will take uses who click the button to my "order now" pag
  • In "class" we assigned the link the "custom-button-black" class.
  • The third part of the link is the GA tracking code

    Now we'll create a button in the custom CSS panel for that class.

Add this code in the custom CSS panel:

.custom-button-black {
 width: 25%;
 height: auto;
 color: white;
 text-align: center;
 vertical-align: middle;
 line-height: 50px; 
 border-radius: 3px;
 letter-spacing: 1px;
 font-family: "proxima-nova";
 font-size: 10px;
 text-transform: uppercase;
 letter-spacing: .2em;
 font-weight: 600;
 font-style: normal;

Share this post

Link to post
  • 0

Paid plugin also available

If you're frustrated with tutorials and want a quick solution that definitely works, check out Squarespace Click Traking Plugin.

It's a paid solution, but a few dollars also makes it 100% sure to work. Money back if it doesn't and 1-on-1 support provided if you have any problems.

The Squarespace Button Block is basically a link as any other, so link tracking is what you need. And it's what our plugin does. The plugin tracks outbound links, internal links, file downloads, button links, social media links etc.

Edited by voxpopagency
Initial Revision

Share this post

Link to post

Create an account or sign in to comment

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

  • Create New...