Klaviyo

Engage your users by enabling Klaviyo push notifications

Overview

The Klaviyo Plugin integrates mobile push notifications to boost user engagement and enable rich audience insights. It supports targeted messaging, leveraging the Klaviyo Swift SDK for iOS and Klaviyo Kotlin SDK for Android.

This guide provides an overview of the plugin configuration and functions available through the Median JavaScript Bridge.

👍

Developer Demo

Display our demo page in your app to test during development https://median.dev/klaviyo/

Implementation Guide

Plugin Configuration

Configure the plugin by updating the following parameters under the Push Notifications tab in Klaviyo:

{
  "apiKey": STRING,
  "autoRegister": true | false, // if true push permission will be requested automatically
}

Deep Linking

The Klaviyo Plugin supports Deep Linking. When deep links are configured, tapping on a push notification will open the corresponding screen in your app.

JavaScript Bridge Functions

The following JavaScript functions are available through the Median JavaScript Bridge:

Request Push Notification Permission

Displays a dialog prompting users to enable push notifications. On Android 13 and above, explicit permission is required; for Android 12 and below, permissions are granted automatically.

↔️Median JavaScript Bridge

median.klaviyo.promptNotification({
  callback: function(result) {
    console.log(result.granted); // true or false
  }
});

Check Push Notification Permission Status

Determines whether push notifications are currently enabled for the user.

↔️Median JavaScript Bridge

median.klaviyo.notificationEnabled({
  callback: function(result) {
    console.log(result.granted); // true or false
  }
});

User Profile Management

Manage user identity and metadata to enable personalized push messaging.

↔️Median JavaScript Bridge

// Get the current user profile
median.klaviyo.getProfile();

// Set user profile attributes
median.klaviyo.setProfile({
  externalId: "USER_ID",
  email: "[email protected]",
  phoneNumber: "+1234567890"
});

// Clear the stored user profile
median.klaviyo.resetProfile();