For example, you could create a custom button and include the forceCommunity:analyticsInteraction event in the button's client-side controller. Clicking the button sends event data to Google Analytics.
onClick : function(cmp, event, helper) { var analyticsInteraction = $A.get("e.forceCommunity:analyticsInteraction"); analyticsInteraction.setParams({ hitType : 'event', eventCategory : 'Button', eventAction : 'click', eventLabel : 'Winter Campaign Button', eventValue: 200 }); analyticsInteraction.fire(); }
Attribute Name | Type | Description |
---|---|---|
hitType | String | Required. The type of hit. 'event' is the only permitted value. |
eventCategory | String | Required. The type or category of item that was interacted with, such as a button or video. |
eventAction | String | Required. The type of action. For example, for a video player, actions could include play, pause, or share. |
eventLabel | String | Can be used to provide additional information about the event. |
eventValue | Integer | A positive numeric value associated with the event. |