PushPROS (API) Functions

Below are some useful JavaScript functions that will allow you to create more targeted notifications, which creates a better experience for your subscribers:

Tracking Attributes:

To track attributes on a user (for instance, store their first name), call this JavaScript method:

_webpushTrackAttributes( {attributes} );

We can use this to store a single attribute, like a user’s first name, like so:

_webpushTrackAttributes({
  "first_name":"Joe"
});

Or we can use it to store multiple attributes, like a user’s first name, age, and favorite animal, like so:

_webpushTrackAttributes({
  "first_name":"Joe",
  "age":"42",
  "favorite_animal":"Ring-tailed lemur"
});

Tracking Events: 

If we want to track events on a user, we would use:

_webpushTrackEvent( category, action, optional_label, optional_value );

For instance, let’s say that a user is on our site, and they clicked on a button that links to an article on our blog site. We could call:

_webpushTrackEvent( "Website", "Clicked", "Blog", "Super Exciting News" );

This is incredibly useful because we can segment users in useful ways, such as:

  • Users on our Website who Clicked the ‘Super Exciting News’ Blog
  • Users on our Website who Clicked any Blog link