Custom Events let you track user activities on your website. Custom Events consist of two pieces of information: a) something happened, b) at a particular time.


  • 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.

  function _webpushrScriptReady(){
    webpushr('event',{"event_name" : "value", "event_action" : "value", "event_label" : "value", "event_value" : "value"  });
Attributes Type Length Required
event_name string 50 Required
event_action string 100 Required
event_label string 100 Optional
event_value string 100 Optional

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:

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

You can also pass Custom Attribute information inside our main javascript snippet, as shown below:

  function _webpushrScriptReady(){
    webpushr('event',{"event_name" : "Purchase", "event_action" : "Nike Sneakers", "event_value" : "55" });

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.
  • Track conversion (or success) of a campaign. Example: track how many people ultimately purchased a new pair of shoes after you sent a push notification campaign on it.

Things to consider when setting Custom Events

As you read above, Custom Events can be tracked in varying levels of detail, based on how you name them, and optionally include values with each event. Plan to keep it simple. You may have other systems that track more detailed specifics of user engagement and activity with your content or e-commerce site. You want to set Custom Events primarily to measure the impact of push notifications. Consider setting Custom Events at a higher level when starting out. For example, as a content publisher, you could track a purchase event in a few ways:

  • Viewed News Section
  • Viewed World News
  • Viewed Article No 56

While the third level of detail provides you with the most detail, you can start with the first level to keep things simple at the outset. As you get more comfortable with properly setting Events and actively using Events to measure a campaign’s performance, you can make Events more granular in detail and start using the optional parameters of event_label & event_value

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
  • To measure conversion (success) of each push campaign

Key uses of Custom Attributes:

  • To create User Segments for sending highly targeted push notifications