Using Events to Track User Interactions

You can implement events in the Dynamic Yield script on your website, or call them using our server-side Experience API. Dynamic Yield offers a variety of predefined event schemas, or you can create your own. You can also track custom events that are fired "off-site" using a pixel.

For details about the parameters and values for events tracked using our Experience API, see the Events endpoint API reference.

For details about script-based event schemas, the ...

📌

In 95% of the cases, we see a response time of 5-25 ms for event reporting calls.

Required events per vertical

Section typeEventDescription
E-CommercePurchaseThe user made a purchase.

Purchases are often used as optimization goals. They contribute to the user's affinity profile and are used in calculating recommendations.
Add to CartThe user added an item to the cart.

Adding items to the cart is often used as an optimization goal, and contributes to the user's affinity profile.
Financial InstitutionsApplicationThe user started the application process for a product. 

Applications are often used as optimization goals, and contribute to the user's affinity profile.
SubmissionThe user submitted an application.

Submissions are often used as optimization goals. They contribute to the user's affinity profile and are used in calculating recommendations.

Events used for cross-channel identification

To identify the same user across devices, you need to have another type of identifier named Customer ID (CUID). This could be a hashed email address, a hashed phone number, or a custom ID you define. When a user is identified with the same identifier more than once their history, affinity profile, and audience inclusion are unified.

To do this, implement events that fire when users perform an action that identifies them. Each event must include the unique identifier that is being used in this section (you can use one CUID type per section):

EventDescription
LoginIndicates that a user has logged in.
SignupThe user completed the signup process.
Newsletter SubscriptionThe user subscribed to a newsletter.
Identify UserUse to identify visitors at any point during their journey on your website, such as during the checkout process.

Additional event schemas

EventDescription
Remove from CartThe user made a purchase.

Purchases are often used as optimization goals. They contribute to the user's affinity profile and are used in calculating recommendations.
Sync CartThe user added an item to the cart.

Adding items to the cart is often used as an optimization goal, and contributes to the user's affinity profile.
Add to WishlistThe user started the application process for a product.

Applications are often used as optimization goals, and contribute to the user's affinity profile.
Keyword SearchThe user submitted an application.

Submissions are often used as optimization goals. They contribute to the user's affinity profile and are used in calculating recommendations.
Filter ItemsThe user filtered the product list by a specific field value.

This event also impacts the user's affinity profile.
Sort ItemsThe user changed the sorting order of a product list.
Not available for API implementation
Change AttributeThe user changed an attribute of the displayed product (category, color, keyword).
Promo Code EnteredThe user entered a valid promo code.
Not available for API implementation
Video WatchThe user watched a video (in part or in full). You can distinguish between auto-playing videos and those the user clicked to watch.

Custom events

If you want to track user actions that are not in our standard event list, you can create a custom event, and implement it via script or server-side API. You can also fire custom events from off-site or websites without the Dynamic Yield script (for example, third-party websites) using a pixel.

Custom event parameters

A custom event can have the following parameters and values:

  • Name: Mandatory parameter. Event name for display. Does not have a dyType property.
  • Properties: Optional parameter. Properties can be strings, numbers, or Boolean. Note that we don't support nested properties when creating targeting rules over custom events.
  • Value: Optional property. Indicates the monetary value of the event, with or without the optional currency designation. This information is used for goals based on events.

🚧

Note

Custom events support only symbols that are encoded with UTF-8 (Basic Multilingual Plane). Some characters with diacritics (additional symbols above or below the letter) are read as the base character. For example, é is processed as e.

Code examples

Here's an example of an event reported via API for a known user identified by a hashed email address:

curl --request POST \
  --url https://dy-api.com/v2/collect/user/event \
  --header 'content-type: application/json' \
  --header 'DY-API-Key: baadc6ba740a35678106dc7857a7eb9c' \
  --data '{
      "user": {
        "dyid": "7282320792394869879",
        "dyid_server": "7282320792394869879"
      },
      "session": { "dy": "e3xi77qrxbsxxxmi18d8kxek6tdd12qj" },
      "events": [
        {
          "name": "ExampleEvent1",
          "properties": {
            "isVIP": "true"
          }
        },
        {
            "name": "exampleEvent2"
        }
      ]
    }'   

Here are some script events: Without properties, with properties, and with both properties and values

DY.API("event", {
   name: "zoom"
 })
DY.API("event", {
   name: "Satisfaction Survey",
   properties: {  
     Customer Support: "Satisfied",
     Shipping: "Very satisfied"
   }
})
DY.API("event", {
   name: "Donation",
   properties: { 
     type: "charity",
     value: 200.00 
   } 
});   

👍

Tip:

As an alternative to adding code to your site, you can use a template called Fire Event in Custom Code campaigns to fire an event without making any code changes. Learn more about using this template.

Off-site events using pixels

You can also fire events from off-site or websites without the Dynamic Yield script (for example, third-party websites) using a pixel with the following syntax:

<img height='1' width='1' border='0' src='//px.dynamicyield.com/dpx?sec=[SITE ID]&uid=[DYID]&name=[EVENT NAME]&props={"[FIRST PROPERTY NAME]": "PROPERTY_VALUE", value: "[MONETARY VALUE]"}' />

For example:

<img height='1' width='1' border='0' src='//px.dynamicyield.com/dpx?sec=8765000&uid=1616793225703586653name=Product_Return&props={"Number of Products": "2"}'/>

Parameters:

  • Domain:
    • If you use the EU data center (adm.dynamicyield.eu) use the domain
      px-eu.dynamicyield.com.
    • If you use the US data center (adm.dynamicyield.com), use the domain px.dynamicyield.com.
  • sec: Section ID. The Section ID appears in the URL when you're in Experience OS, next to SectionId (it's a 7-digit number that starts with 87 or 98).
  • uid: Dynamic Yield Identifier (DYID). This will connect the event to the user that triggered it.
  • name: Event name. This name will appear in the Dynamic Yield console, in the audience condition, and in the reports.
  • props: The properties and their values you want to send in the event.

Note: If you want to attribute off-site events to your campaigns in experience reports, the attribution window of the campaigns must be set to 1 day or 7 days, but cannot be session-based.