JavaScript API overview

Pass data to Dotdigital Personalization with JavaScript.

The Personalization JavaScript API is included in the Personalization Tracking script and can be used to pass data and events from single page applications, without the need to rely on scraping or a data layer. This allows you to pass data from an app built with a framework such as React, Angular, or vue.js (or plain JavaScript).

The API allows your app, for example, one built using React, to inform Personalization of important changes.

For example:

  • When site visitors log in, you can also pass information about them to Personalization for use in triggered messages or in personalized content.
  • You can raise custom signals from your app to start custom trigger programs. This allows the system to respond to specified actions of your customer on your site. For example, if they have ordered a brochure or viewed a particular page.
  • You can pass data through to the signal, which is available all the way through to email send time, meaning it can be merged into an email.

Tracking activity

In addition, to allow you to enrich data and trigger actions, it's important to raise events so that Personalization can track user activity in your app. You should review all the events and raise those which are appropriate to your app and user activities.

Other functionality

There are also calls that allow you to:

  • Notify Personalization when a page has changed, for example, moved from a product list page to a product details page.
  • Pass through the data of the items on the current page
  • Register for notifications when certain events occur within the Personalization script. You have the option of cancelling the event, for example, if you want to block a Slot from loading.