Newer Version Available
forceCommunity:analyticsInteraction
Tracks events triggered by custom components in Communities and sends the data to Google
Analytics.
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.
1onClick : function(cmp, event, helper) {
2 var analyticsInteraction = $A.get("e.forceCommunity:analyticsInteraction");
3 analyticsInteraction.setParams({
4 hitType : 'event',
5 eventCategory : 'Button',
6 eventAction : 'click',
7 eventLabel : 'Winter Campaign Button',
8 eventValue: 200
9 });
10 analyticsInteraction.fire();
11}| 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. |