Skip to main content
All CollectionsDevelopersAPI
Poper JavaScipt Events API
Poper JavaScipt Events API
Karan Bhakuni avatar
Written by Karan Bhakuni
Updated over a week ago

Poper offers a range of JavaScript events that you can capture to track user interactions with your popups and widgets. By using these events, you can gain valuable insights into user behavior and optimize your marketing strategies.
โ€‹

Key Poper JavaScript Events:

  • poper_display: Triggered when a popup or widget is displayed.

  • poper_close: Triggered when a popup or widget is closed.

  • poper_submit_form: Triggered when a form within a popup or widget is submitted.

  • poper_open_link: Triggered when a link within a popup or widget is clicked.

  • poper_play_game: Triggered when a user interacts with a gamified element within a popup.

  • poper_go_to_step: Triggered when a user progresses to the next step in a multi-step popup.

Capturing Events with JavaScript:

To capture these events in your website's JavaScript code, you can use the addEventListener method:
โ€‹

JavaScript

document.addEventListener('poper_display', function() { 
// Code to execute when a popup is displayed
console.log('Popup displayed');
});

document.addEventListener('poper_close', function() {
// Code to execute when a popup is closed
console.log('Popup closed');
});

document.addEventListener('poper_submit_form', function(e) {
// Code to execute when a form is submit
// We send more details in event, such as form data, visitor details
console.log('Form :', e.detail);
});

// ... and so on for other events

Leveraging Events for Analytics:

You can use these events to trigger custom events in your analytics tools (like Google Analytics) or to send data to your server for further analysis. This can help you track key metrics such as:

  • Popup Impressions: How often your popups are displayed.

  • Click-Through Rates: How often users click on links or buttons within your popups.

  • Conversion Rates: How often users complete desired actions (e.g., form submissions, purchases).

  • User Engagement: How long users interact with your popups.

By effectively utilizing Poper's JavaScript events, you can gain valuable insights into user behavior and optimize your marketing strategies accordingly.

Did this answer your question?