Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunitySubmit a ticketLog In
GitHubNuGetDev CommunitySubmit a ticket

Custom events

You can create custom events in Optimizely Data Platform (ODP) to account for events and fields that are specific to your site and customer experience.

Format

The format for sending custom events in the ODP Web SDK is as follows:

zaius.event("your_event_type_here", { 
    action: "your_event_action_here",
    example_custom_field: "example_value"
});

Custom event examples

The following examples show Web SDK custom events and how those custom events display on the customer profile in ODP.

The value in the campaign event type displays on the customer profile. For example, if campaign is set to Opticon Newsletter, then Opticon Newsletter displays on the customer profile in ODP.

Forms

zaius.event('web_form', {
  action: 'impression', 
  form_name: 'Opticon Newsletter', 
  campaign: 'Opticon Newsletter' 
});  

zaius.event('web_form', {
  action: 'submission', 
  form_name: 'Opticon Newsletter', 
  campaign: 'Opticon Newsletter' 
});

The custom event in the code sample above displays on the customer profile as shown below:

Search

zaius.event('navigation', {
  action: 'search', 
  search_term: 'opticon', 
  campaign: 'Search Term: opticon' });  

zaius.event('search', { 
  action: 'no_results' , 
  search_term: 'optcon', 
  campaign: 'Search Term: optcon' });  

zaius.event('search', { 
  action: 'click' , 
  search_term: 'opticon', 
  campaign: 'Content Result Click -- Search Term: opticon', 
  value: '<https://www.optimizely.com/opticon/>' 
});

The custom event in the code sample above displays on the customer profile as shown below:

Other

zaius.event('venue', { 
  action: 'visited', 
  enue_name: 'Stamford Stadium', 
  campaign: 'Stamford Stadium' 
});

The custom event in the code sample above displays on the customer profile as shown below: