Introduction

Custom Events let you track user activities on your website. A Custom Event can be used to track a specific activity such as a specific page load. Each Custom Events tracks two things: 1- Something happened on your site 2- Time of occurence.

Examples:

  • A Custom Event can be recorded when a user purchases a computer on your site.
  • A Custom Event can be recorded when a user lands on your "Help" webpage.
  • A Custom Event can be recorded when a user signs up for your services.

Once you know what Custom Event you want to set, simply call the _webpushrScriptReady function anywhere on the page.

<script>
  function _webpushrScriptReady(){
    webpushr('event',{"event_name" : "value", "event_action" : "value"  });
  }
</script>
Attributes Type Length Required
event_name string 50 Required
event_action string 100 Required

Sample Code

If you want to record a Custom Event when someone purchases a pair of Nike sneakers on your site. You can do that by adding the following on purchase confirmation page:

<script>
  function _webpushrScriptReady(){
    webpushr('event',{"event_name" : "Purchase", "event_action" : "Nike Sneakers"});
  }
</script>

Why set Custom Events?

Custom Events help you in following primary ways:

  • Create User Segments based on a particular activity. Example: create a Segment for users who have bought sneakers on your site.
  • Trigger an Automatic Push Notification when the Custom Event occurs. Example: send a discount coupon when someone adds an item to their cart.

How are Custom Events different from Custom Attributes?

Custom Events are used to record an activity on your site. Custom Attributes augment user information.

Examples of Custom Events:

  • Registering for an account
  • Using a new feature
  • Watching a video
  • Viewing a specific screen
  • Saving or sharing content
  • Adding a product to a list or cart
  • Making a purchase

Examples of Custom Attributes:

  • E-mail Address
  • Phone Number
  • Gender
  • Age
  • Household Income

Key uses of Custom Events:

  • To trigger Automatic Push Notifications

Key uses of Custom Attributes:

  • To create User Segments for sending highly targeted push notifications