---
schema_version: "1"
id: 12a3744bd414dde64d421a378ab62bb483652c0e8a82fa53d795529e01bb49a3
title: Analytics Interaction
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/lightning-base-components/lightning-design-system/guides/aura/components/forceCommunity/analyticsInteraction/forceCommunity-analytics-interaction.md
canonical_url: https://developer.salesforce.com/docs/platform/lightning-component-reference/guide/forceCommunity-analytics-interaction.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 23b07a404b5c5bde4ab95e0eb878c1944fd62c4a69fc69a79ed84b66150b32fa
products:
  - Lightning Component Reference
---
# 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.

```javascript
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](https://developer.salesforce.com/media/check.png) |
| `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  |         |                                              |

:::::

::::::
