Search docs/

WonderPush

Push notification delivery with the WonderPush service.

Get started in minutes: Ionic Quickstart Guide.

Requires the Cordova plugin wonderpush-cordova-sdk.

WonderPush is the most effective way to retain your users and grow your audience while remaining fully GDPR compliant.

https://github.com/wonderpush/wonderpush-cordova-sdk

Stuck on a Cordova issue?

If you're building a serious project, you can't afford to spend hours troubleshooting. Ionic’s experts offer premium advisory services for both community plugins and premier plugins.

Contact Us Today!

Installation

ionic cordova plugin add wonderpush-cordova-sdknpm install @ionic-native/wonderpush
Ionic Native Enterprise comes with fully supported and maintained plugins from the Ionic Team. Learn More or if you're interested in an enterprise version of this plugin Contact Us

Supported Platforms

  • Android
  • iOS

Usage

import { WonderPush } from '@ionic-native/wonderpush';


constructor(private wonderPush: WonderPush) { }

...

// Subscribe user
this.wonderPush.subscribeToNotifications()
  .then(() => console.log("User subscribed to notifications"))
  .catch((error: any) => console.error(error));


// Send an event (a purchase in this example)
this.wonderPush.sendEvent('purchase', {
  float_price: 12.99,
  string_sku: "X123456"
});

// Tag users (as customers)
this.wonderPush.addTag('customer');

// Personalize
1. Store user details.
2. Use those details to create segments.
3. Include those details in your notifications.
this.wonderPush.putProperties({
  string_name: 'John D.',
  int_age: 24
});

// GDPR
1. set REQUIRES_USER_CONSENT=true to enable GDPR compliance.
2. WonderPush doesn't start until setUserConsent(true) is called.
const onClick = (userConsent: boolean) => this.wonderPush.setUserConsent(userConsent);

// Listen to notification clicks
document.addEventListener('wonderpush.notificationOpen', function(event) {
  console.log('Notification opened', event.notification);
  if (event.notificationType === 'data') {
    console.log('Silent notification', event.notification);
  }
});