1.0.0 • Published 12 months ago

@gopush/notifications v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
12 months ago

Initialization

import notifications from '@gopush/notifications';

notifications()
  .go({
    appKey: 'YOUR_API_KEY',
  })
  .catch(e => {
    console.log('Integration error: ', e);
  });

User session tracking

// Track anonymous sessions and user log outs
notifications().startAnonymousSession();

// Track user session
notifications().startUserSession({ id: 'user_id' });

Segmentation

notifications().setTag('tagName', 'value');

Subscription popup customization

notifications()
  .go({
    appKey: 'YOUR_API_KEY',
    subscriptionPopup: {
      position: 'center', // 'top' | 'center' | 'bottom',
      delayMs: 5000, // Popup display delay (defaults to 3 sec)
      retryDelayMs: 10000000, // Subscription popup will be displayed with this delay again after user rejects it (defaults to 1 week)
      title: 'popup title',
      message: 'popup message',
      accept: {
        text: 'Ok', // Accept button text
        color: '#7f8f9f', // Accept button text color
        backgroundColor: '#9ef542', // Accept button background color
        borderColor: '#fff', // Accept button border color
      },
      reject: {
        text: 'Ask later', // Reject button text
        color: '#7f8f9f', // Reject button text color
        backgroundColor: '#2e2828', // Reject button background color
        borderColor: '#fff', // Reject button border color
      },
      iconUrl: 'https://cdn4.iconfinder.com/data/icons/ionicons/512/icon-ios7-bell-512.png', // Optional icon
      backgroundColor: 'transparent', // Popup background color
      boxShadow: '10px 5px 5px', // Popup shadow
    },
  })
  .catch(e => {
    console.log('Integration error: ', e);
  });
1.0.0

12 months ago