onclick with Callout

Is there a trick (or any way) to add an onclick event tracker to a CTA link in a callout or button? Such as:

onclick="_gaq.push([’_trackEvent’, ‘Download’, ‘2016 Conference’, ‘Variant 2’]);"

Thanks!

Hey Andy,

I think this can be achieved via jQuery but I’m not really sure. You can check this thread on SE as it discusses the same thing. I tried achieving the same thing and I end up with this.

  1. Placed a class on the Callout module onclick-test
  2. Added this jQuery code in the customizer
jQuery(document).ready(function() {
  jQuery(".onclick-test .fl-callout-button a").on("click", function() {
    _gaq.push(['_trackEvent', 'Download', '2016 Conference', 'Variant 2']);
  });
});

Hope this helps!

Ben

1 Like

Thanks Ben!

Hey Andy,

No worries! Have fun with The Beaver! :slight_smile:

Ben

Any update on if this worked? I guess I can try it for myself.

Hey David,

Sorry to say but I haven’t tried it for myself. Feel free to give it a shot! :slight_smile: And if you can report back what you find, that would be awesome! :slight_smile:

Ben