Analytics Interaction

forceCommunity:analyticsInteraction

Tracks events that are triggered by custom components in Aura-based Experience Builder sites and sends the data to Google Analytics.

For Use In

Experience Builder Sites

::::::tabset{tabs='[ "Develop", "Specifications"]'}

:::::tab

This example creates a custom button and includes the forceCommunity:analyticsInteraction event in the button's client-side controller. Clicking the button sends event data to Google Analytics.

handleClick : 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();
}

This event is supported in Aura-based Experience Builder sites only. To enable event tracking, add your Google Analytics tracking ID in Settings | Advanced in Experience Builder and publish the site. Google Analytics isn’t supported in sandbox environments.

:::::

:::::tab

Attributes

Name Description Type Default Required
eventAction The type of action. Required for 'event' hitType. string
eventCategory The type or category of item that was interacted with. Required for 'event' hitType. string
eventLabel A label for providing additional event information. string
eventValue A positive numeric value associated with the event. integer
exDescription A description of the exception. string
exFatal True if the exception was fatal. boolean
hitType The type of hit. Supported types: 'event', 'social', 'exception', 'timing'. string Yes
socialAction The type of action that happens. Required for 'social' hitType. string
socialNetwork The network on which the action occurs. Required for 'social' hitType. string
socialTarget Specifies the target of a social interaction. Required for 'social' hitType. string
timingCategory A string for categorizing all user timing variables into logical groups. Required for 'timing' hitType. string
timingLabel A string that can be used to add flexibility in visualizing user timings in the reports. string
timingValue The number of milliseconds in elapsed time to report to Google Analytics. Required for 'timing' hitType. integer
timingVar A string to identify the variable being recorded. Required for 'timing' hitType. string

:::::

::::::