Version `2.18.0` and above of the Q4 Framework includes a shortcode for creating buttons tied to Google Analytics event tracking.
Usage
The shortcode [eventtrackingbutton]
accepts the following attributes:
text
– The display text of the generated button.link
– Thehref
value for the button / the URL that the button will go to.target
– Can be set to_blank
to have the button open it’s link in a new tab.category
– Analytics category.action
– Analytics action.label
– Analytics label.value
– Value to be tracked in a analytics.
Any of these attributes other than text
and link
may be left blank or omitted if not required. The final format for the shortcode should follow this example:
[eventtrackingbutton text="Click Here" link="/some-page" category="thing-to-track" action="clicks" label=""]