Custom Events

Use custom events to report any event that isn't already defined for use in Experience OS, but is significant to your business.

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

that 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 
   } 
});   

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.