Skip to main content


Optimizely Form Events – Implement an Interface Pattern

Istock 1069272512

Optimizely CMS provides customization of content using events. A standard collection of events exists for most content types. However, additional events are available to further customize Optimizely Forms. To subscribe to Form events you use an Initialization module to attach an event handler. The logic for the event is typically defined in the same class. For handling a single form or event this might be enough. Sometimes, though, you need more event handlers for different form types. While the event method can handle this, using an Interface pattern can be cleaner.

An Interface pattern allows you to define the event handlers based on an Interface. A custom Interface is defined for each event, and any class that needs to handle an event inherits from the appropriate Interface. This approach allows you to define the event methods on the objects requiring them, instead of in the Initialization module. It results in cleaner code, and makes it easier to identify which objects handle events.

To learn more about implementing this approach, read my article, Optimizely Form Events using an Interface Pattern, and leave a comment below to share additional helpful information.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Daved Artemik

More from this Author

Follow Us