Track

Fires an analytics event when the user interacts with the child component. By default this fires when the user clicks on the child component, but this can be overriden using the trigger prop. The value of trigger should be the name of the event prop to bind to. All additional props will be passed as options along with the event.

Example:

<Track event="addedToCart" product={this.props.product}> <Button>Add to Cart</Button> </Track>
Import
import Track from 'react-storefront/Track'

Props

NameTypeDefaultDescription
eventstring

The name of the method to call on all configured analytics targets. For example, "addedToCart".

triggerstring'onClick'

The name of the handler prop on child component to intercept. Defaults to "onClick"

onSuccessfuncFunction.prototype

A function to call once the event has been successfully sent by all analytics targets.

ampDataobject{}

Additional data to send when tracking events in AMP.