On JavaScript: Configuring an Experience Triggered by a JavaScript Event

Modified on Mon, 27 Nov 2023 at 04:43 AM

Hushly provides different types of triggers based on specific user actions or the expiry of a timer.

However, you may want to create a trigger of your own. You can use the JavaScript event trigger to detect a user event and trigger an Experience.

Some example user events are:

  • User scrolls to the end of the page.
  • The user clicks a specific button or link.
  • When a known user accesses the page.

To create an Experience:

  1. From the Left Nav Menu, click Experiences.

  2. On the Experiences page, click Create an Experience.
  1. In the New Experience pop-up window, enter the name of the Experience.


  2. Enter the description. The description is an optional field. Other users from your organization can view the description.

  3. Click Save. You are redirected to the Settings tab.

  4. On the Settings tab, fill in the various parameters of the Experience.


  5. The Name & Description section opens with the Experience name and description filled with the details you entered earlier. You can edit the name and description.

  6. To configure the appearance of an Experience, refer to  Branding for an Experience. Also, to configure localization of the opt-in form elements, refer to  Adding Localization and Event Handlers.

Who: Defining the Target Audience

You can use the Who tab to define the target audience for the Experience. When the target audience matches, the Experience is shown to the user.


To configure the target audience:

  1. Click the Who tab.


  2. Select the audience (using Page URL, Page URL Path, Traffic Source), location (using IP Address, Country), and device type. To know more about rules, refer to the topic,  More About Rules.


Page URL: URL of the page where the Experience triggers.

Page URL Path: Part of the page URL.

Referrer URL: Reference URLs are the URLs that refer the user to the webpage.

IP Address: IP address of the device accessing the webpage.

Traffic Source: Search engine or website.

Last Exit-Intent Popup Time: After the exit-intent pop-up is shown once to the user:

  • To show the exit-intent pop up again.
  • Alternatively, not show it for an interval configured using this option.

Country: The country of the user.

Important: If Data Providers such as Bombora, 6sense, are configured for your firm, you can create rules based on data as well.

  1. Use the following comparison criteria to define a rule.
  2. Enter the value for the rule in the text box.

  3. To add another rule, click Add Rule and repeat steps 1 to 4.
  4. Click Match ANY Rule to configure what rules should be matched.

Match Any: The Experience is launched when at least one rule matches the user’s state.

Match All: The Experience is launched when all rules match the user’s state.

Match Advanced: The Experience is launched when the combination of rules matches the user’s state.

Note: To know more about rules and how to define rules, and matching the rules, refer to the topic,  More About Rules.

  1. To sort the order of the defined rules, Click on the icon to drag and drop the rule in the position required.

  2. Click Save Changes to save the configuration.

  3. Click Next to save the configuration and go to the What tab

What: Choosing the Assets to Showcase when the Experience Opens

You can use the What tab to add Assets to an Experience. The user is shown these Assets when the Experience is launched.

The first Asset shown to the user is known as the Primary Asset. The remaining Assets of the Experience are displayed in the Recommended section of the Experience.

  1. Click the What tab.

  2. Click Add Assets or the Click here link.


  3. From Add Assets to Experience pop-up window, select the Assets you want to include. You can also search for the Assets using the Search and Advanced Search options.


  4. Select the Assets.


  5. Click Add Assets to add the selected Assets to the Experience.


  6. Click Next to go to the When tab.
    Note:
    You can also define and add Assets to the Segment refer Associating a Segment and Adding Assets to it.

When: On JavaScript Event

You can trigger an Experience in a pop-up window based on a custom event using On JavaScript event.

  1. Click the When tab.


  2. Click On JavaScript Event. The On JavaScript event section opens.
  3. Select the device type. The Experience is launched only for the selected device type. To trigger the Experience on all device types, select All:
  4. Enter the JavaScript event name. You should have already configured the JavaScript event on your webpage. For example, you can use the scrolled JavaScript event to trigger the Experience when the user scrolls to the bottom of the page.
  5. Click Add New to add more events.
  6. Click Save Changes to save the configuration.

    Important: To preview and test the Experience, refer to Previewing the Experience and Testing the Experience respectively. You can preview or test the Experience before or after publishing the Experience.

Publishing an Experience

  1. Click Publish
  2. A confirmation alert appears. Click OK. The Experience is published.

Related Topics:
On Exit-Intent: Configuring an Experience for User Exiting the Webpage

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 atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article