Event Handlers

Modified on Tue, 15 Nov, 2022 at 1:44 AM

Hushly JavaScript Events API is extremely powerful, providing the tools needed to further extend Hushly to suit your specific needs.


  1. From the Left Nav Menu, click Setup > Settings.

  2. Scroll to the Tracking section, Configure the event handler in the Event Handlers field

    Usage:

    hushly('bind', EVENT-NAME, function(options) {
        // event handling code.
    });


    options object will contain the attributes of the Hushly event. Check the event documentation below to find the attributes available in the options object.

    Example1: Publishing a custom event to Google Analytics when content is viewed via Hushly Experience.

    // use hushly event handler to publish a custom event to google analytics.
    hushly('bind', 'content-view', function(options) {
        ga('send', 'event', {
            'eventCategory': 'Hushly Experience',
            'eventAction': 'Content View', 
            'eventLabel': options.experienceName
        });
    });


Example2: Publishing a custom event to Bizible when Form is Submitted via Hushly Experience.

// On Hushly Form Submit Push Bizible Event 
hushly('bind', 'form-submit', function(formData) {
    // Preamble for all API usage.
    window['Bizible'] = window['Bizible'] || 
      { _queue: [], Push: function (o, p) {this._queue.push({ type: o, data: p }); } };
    
    Bizible.Push('User', {
      eMail: formData.email,
      country: formData.country
    });
});


Please check Event Handling API Documentation.





Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article