Streaming live at 10am (PST)

Google Analytics event tracking for buttons in Webflow


Hi Sergie,
Thanks for the quick response. Your suggestions were spot on. I was able to get event tracking working by adding custom attributes. Thanks for your help.

  • DesignerPC


Hey guys, hey @thesergie

I tried to follow your solution to add event tracking with GA for visitors clicking on "download on appstore" buttons on our page ( but when I setup a custom attribute with the name "onClick" an error message in red comes up: This is a reserved name.

Any way around this? Thank you in advance!


Onclick event - Reserved message

Thanks @thesergie... I was looking for an answer here as well.

We do a lot of seo / google analytics work.



It kind of always does... put your cursor/focus on the next field, or the previous if you're already on the second, and the red color disappears.

Edit : just tested it, and you're right, onClick produces a real error that I don't know how to get around.

1 Like


It worked a couple months ago, but for security reasons we've disabled it.

We'll update you guys soon on what's going on. Sorry about any inconvenience!

1 Like


Hey guys, one workaround to this for the time being is to use the custom code feature to wire up an event handler.

First, give your link some unique ID in the Settings tab:

Then go to your site's Dashboard, go to the Custom Code section, and add the following example code in the Footer Code section:

  $(document).ready(function() {
    $('#my-unique-link').on('click', function(e) {
      _gaq.push(['_trackEvent', 'Lightbox', 'Open', 'Microsoft Project']);

If you have a lot of these all across your site with different parameters, you can create a common handler that keys off of allowed custom attributes, like so:

First add a data-gatrack attribute to the links you want to track. You can call it whatever you want, but it should start with data- and it must match the script (shown below) exactly.

Then add the following more-generic click handler to the Footer Code of your site:

  $(document).ready(function() {
    $(document).on('click', '[data-gatrack]', function(e) {
      var $link = $(this);
      var trackData = $'gatrack');
      if (!trackData) { return; }
      var trackParams = ['_trackEvent'].concat(trackData.split(','));

Note that attribute names here are case-sensitive, so if you set your custom attribute to something like data-gaTrack and don't update the script to reflect that, it won't work.


Custom attributes like onclick, onkeydown, onkeyup and onchange are reserved
Mixpanel + Webflow
Fire Adwords Conversion Tracking Upon Form Submission
autoPlay attribute is busted with error
Custom attributes for angular 2

Thank you guys, I tried the first option and it works! Thank you so much!



@callmevlad. Does your second option here work on tracking light box clicks? Can't seem to get it work. Do you still need to add a unique I'd as in the first option?



Too complex for me to accomplish this in a short period. Can you post an exemple that will work with localize.js instantly?
Thanks again.



Hi! Please, update us on what's going on! :smile: We still not able to use "onclick" attribute? And what to do? How to track an events directly, without "workarounds"?



Hi this doesn't seem to be working. I've set up exactly as you've described here and I'm not getting anything register on my Analytics account. You can see from this image that link settings are set up correctly:

You can see from this image that the snippet is in my footer.


Any ideas on how I can fix this? I really need to start tracking button clicks.


1 Like


Forget that, it must have taken a few minutes to register as it wasn't showing on live analytics but it is now.



How to make correct script for Universal Google Analytics?

Doesn't work((

1 Like

closed #16

This topic was automatically closed after 24 hours. New replies are no longer allowed.


opened #17


Hey guys! Any news to add atribute onClick for buttons? It seems they doesnt works...



yes, they don't. the workaround is to place a GTM container inside the < body > and to create Event tags in the Google Tag Manager.
It works fine for me.



I tried option 2 here with the generic click-handler in the footer code and it's not working, at least as far as I can tell with the tag assistant. (



I am not able to track the Form Submission of my website even after using onclick event. Do I need to do anything else after the code?



I'm still not able to get any event tracking... Has anyone has luck with Event Tracking in Webflow? (without the Google Tag manager)