events

Dimensions and metrics are vital components to reports. The events variable is responsible for data collection of many metrics on your site. Events typically increment metrics in reports.

Before implementing events, make sure that you create and configure them under Success events in Report suite settings. If you plan to use custom events in link tracking hits, make sure that linkTrackVars and linkTrackEvents are set correctly.

Events using the Web SDK

If using the XDM object, custom events use the following XDM fields:

  • Custom events 1-100 are mapped to xdm._experience.analytics.event1to100.event1 - xdm._experience.analytics.event1to100.event100.
  • Custom events 101-200 are mapped to xdm._experience.analytics.event101to200.event100 - xdm._experience.analytics.event101to200.event200.
  • This pattern repeats every 100 events to xdm._experience.analytics.event901to1000.event901 - xdm._experience.analytics.event901to1000.event1000. eventx.value is used to specify the amount to increment. eventx.id is used for serialization.
  • Orders are mapped to xdm.commerce.purchases.value.
  • Units are mapped to the sum of all productListItems[].quantity fields.
  • Revenue is mapped to the sum of all productListItems[].priceTotal fields.
  • Product Views are mapped to xdm.commerce.productListViews.value.
  • Carts are mapped to xdm.commerce.productListOpens.value.
  • Cart Additions are mapped to xdm.commerce.productListAdds.value.
  • Cart Removals are mapped to xdm.commerce.productListRemovals.value.
  • Cart Views are mapped to xdm.commerce.productListViews.value.
  • Checkouts are mapped to xdm.commerce.checkouts.value.
NOTE
If an event is set under productListItems (for example, productListItems._experience.analytics.event1.value) and that event is not yet in this field, that event is automatically added to this field.

If using the data object, all events use data.__adobe.analytics.events, following AppMeasurement string syntax. If you set this field, any events set in the XDM object are overwritten and not sent to Adobe Analytics.

Events using the Adobe Analytics extension

You can set events either while configuring the Analytics extension (global variables) or under rules.

  1. Log in to Adobe Experience Platform Data Collection using your AdobeID credentials.
  2. Click the desired tag property.
  3. Go to the Rules tab, then click the desired rule (or create a rule).
  4. Under Actions, click an existing Adobe Analytics - Set Variables action or click the ‘+’ icon.
  5. Set the Extension drop-down list to Adobe Analytics, and the Action Type to Set Variables.
  6. Locate the Events section.

Several features are available:

  • A drop-down list that allows you to select the event to include
  • An optional text field for serialization. See event serialization for more information.
  • An optional text field for an event value. You can include currency for currency events, or an integer for non-currency events to increment it multiple times. For example, selecting event1 under the drop-down list and including 10 in this field increments event1 by 10 in reporting.
  • A button to add another event. You can add as many events as you’d like to a single rule within reason.

s.events in AppMeasurement and the Analytics extension custom code editor

The s.events variable is a string that contains a comma-delimited list of events to include in the hit. The variable allows up to 64k bytes, effectively allowing as many events as a hit needs. Valid values include:

  • event1 - event1000: Custom events, set however you’d like. Record how you use each event in your organization’s solution design document. The number of available events depends on your organization’s Analytics contract. Most organizations on non-legacy contracts have 1000 custom events available. Contact your Adobe Account Team if you are not sure how many custom events are available to you.
  • purchase: Increments the ‘Orders’ metric by 1, and takes values set in the products variable to calculate ‘Units’ and ‘Revenue’. See purchase event for more information.
  • prodView: Increments the ‘Product Views’ metric.
  • scOpen: Increments the ‘Carts’ metric.
  • scAdd: Increments the ‘Cart Additions’ metric.
  • scRemove: Increments the ‘Cart Removals’ metric.
  • scView: Increments the ‘Cart Views’ metric.
  • scCheckout: Increments the ‘Checkouts’ metric.
NOTE
This variable is case-sensitive. Avoid mis-capitalizing event values to ensure accurate data collection.
// Set the events variable to a single value
s.events = "event1";

// Set the events variable to multiple values
s.events = "event1,event13,purchase";

Increment counter events multiple times

You can count custom events more than once if desired. Assign an integer to the desired event within the string. Events created in report suite settings are counter events by default.

// Count event1 ten times
s.events = "event1=10";

// Count event1 twice and event2 once
s.events = "event1=2,event2";
NOTE
Counter events do not support currency or decimal values. Use currency events for currency, or numeric events for decimal values.

Use currency events

You can change a custom event to use currency instead of integers. Currency events automatically convert to the report suite’s currency if the report suite currency and the currencyCode variable do not match. They are useful to help calculate shipping costs, discounts, or refunds. You can set currency events in the products variable if you want to attribute the event to only that product.

Before implementing currency events, make sure that you set the desired event to ‘Currency’ under Success events in Report suite settings.

// Send $9.99 USD in event1 using the events variable. Make sure the event type for event1 is Currency in Report suite settings
s.currencyCode = "USD";
s.events = "event1=9.99";

// Send $9.99 USD in event1 using the products variable. Make sure the event type for event1 is Currency in Report suite settings
s.currencyCode = "USD";
s.events = "event1";
s.products = "Example category;Example product;1;0;event1=9.99";
NOTE
If you set a currency value in both the events variable and the products variable, the currency value in events is used. Avoid setting currency values in both the events and products variables.

Use numeric events

You can change a custom event accept decimal values instead of integers. Numeric events behave similarly to currency events, except they do not use currency conversion. You can set numeric events in the products variable if you want to attribute the event to only that product.

Before implementing numeric events, make sure that you set the desired event to ‘Numeric’ under Success events in Report suite settings.

// Send 4.5 in event1 using the events variable. Make sure the event type for event1 is Numeric in Report suite settings
s.events = "event1=4.5";

// Send 4.5 in event1 using the products variable. Make sure the event type for event1 is Numeric in Report suite settings
s.events = "event1";
s.products = "Example category;Example product;1;0;event1=4.5";
NOTE
If you set a numeric value in both the events variable and the products variable, the numeric value in events is used. Avoid setting numeric values in both the events and products variables.
recommendation-more-help
b4f6d761-4a8b-4322-b801-c85b9e3be690