HomeGuidesAPI ReferenceGraphQL
Submit Documentation FeedbackJoin Developer CommunityOptimizely GitHubOptimizely NuGetLog In

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.

The format for custom events in the Web SDK for ODP:

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

Below are some examples of 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

๐Ÿ“˜

Note

You must create the form_name object. Refer to Objects & Fields for more information.

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 will display on the customer profile as shown below:

Search

๐Ÿ“˜

Note

You must create the search_term object.

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 will display on the customer profile as shown below:

Other

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

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


Did this page help you?