This module is exactly like the built-in Beaver Builder “Button” module, except with an extra tab of Google Analytics Event Tracking settings:
As long as you’ve included the main Google Analytics tracking script on your site, this module will do the rest. Simply drag and drop the “Button with GA Event Tracking” module (under “Basic Modules” in the page builder) onto your page, then click on the “Event Tracking” tab in the module settings pane.
Note that Category and Action are required by Google Analytics, while Label and Value are optional (Value can only be an integer).
Once you’ve added your event details, finish styling your button and add your link as usual. When you’re finished, give your new button a test (you should be able to see if it’s working under “Real Time,” then “Events” in your Google Analytics dashboard). Your custom Analytics event should be tracking like a charm!
This module uses the ‘beacon’ transport method, which relies on the navigator.sendBeacon() method. This is a much more reliable way to ensure that your interactions are tracked before the page is unloaded (e.g., when a link is clicked). However, since some browsers do not support the navigator.sendBeacon() method at this time, a polyfill script has been included with the module to ensure that event tracking will work across the board.
This module will not work with the legacy version of the Google Analytics script (ga.js).
Installing Beaver Brewer modules is easy! If this is your first time, check out the Beaver Brewer Module Installation Guide for instructions.