⚠️ This package has not been released as a stable release, and changes may occur.
Easy dispatching of events in Adapt Retail.
npm install @adapt-retail/adapt-eventThe event class will help you dispatch events in Adapt Retail. You can use it to track whatever event you like, but we got some preconfigured events for you.
When installed, simply import the package with normal node syntax.
// EcmaScript6 and upimportAdaptEventfrom'@adapt-retail/adapt-event';/* * @param event * @param description (optional) * @param position (optional) * * @return void */AdaptEvent.dispatch('Event name','Description');If you dispatching an MouseEvent, add the event as the third parameter to track where the click occur.
varlogo=document.querySelector('.logo');logo.addEventListener('click',function(event){AdaptEvent.dispatch('click','on-logo',event);});It is possible to extend the functionality of the AdaptEvent using plugins. This could be f.eks. extending the event to match other display networks, such as Google Double Click and AdForm.
Read how to build your own in the documentation
AdaptEvent.addPlugin(newPlugin);We are also including some default plugins to make your life easier.
Read more in the documentation
// Import and add pluginimport{AdaptEvent,AdaptClickEvent,AdaptGoogleAnalythics}from'@adapt-retail/adapt-event';AdaptEvent.addPlugin(newAdaptClickEvent);AdaptEvent.addPlugin(newAdaptGoogleAnalythics);// Track a click document.querySelector('.logo').adaptClick(function(event){
...
},'a-click','logo');// Track click and navigate to urldocument.querySelector('.logo').adaptClickAndNavigate('https://adaptretail.com','navigate','from-logo');# Install dependencies
npm install
# Run test suit
npm run test# Run test suite on file change
npm run tdd