LogoLogo
Sign inSign up
  • PushPushGo Documentation
  • Web push
    • Overview
    • Instructions
      • Subscription tests
    • Service worker
      • Subdomains / Wildcards
    • Integration script
      • Subscription form
        • Subscription form creator
          • Topics
        • Subscription form delay
        • Display form rules
        • Confirmation window
      • Bell widget
        • Inbox
        • Topics
      • Google Analytics & Google Tag Manager
      • Default notification
      • Beacons
      • Security SRI / CSP
    • SDK Client
      • Legacy SDK (deprecated)
        • Examples
    • JS Code
    • Safari support
    • FAQ
  • Mobile push
    • Overview
    • Google Android
    • Apple iOS
    • Huawei Android
  • ONSITE NOTIFICATIONS
    • Overview
  • Onsite notifications
    • Create onsite notification
    • Edit onsite notification
    • Onsite notification report
    • Inbox
  • Onsite notifications list
  • Subscribers
    • Subscribers
      • Activity status
      • Subscriber Details
    • Labels
      • System Labels
      • Add Labels Manually
    • Segments
      • Create Segment
      • Copy Segment
      • Update Segment
      • Delete Segment
    • Geolocation
  • Campaigns
    • Campaigns
    • Push campaign
      • Create Campaign
        • Content
        • Audience
          • By Segment
          • By Labels
        • Provider options
        • Time
        • Drafts
      • Campaign List
        • Cancel Campaign
        • Copy Campaign
        • Copying and pasting campaigns between projects
        • Delete Campaign
      • Campaign Report
    • AB test
      • Create AB test
        • Variants
        • Audience
        • Provider options
        • Time
        • Save draft or accept a test
      • AB test list
      • Winner selection
      • AB test report
      • Cancel AB Test
      • Send AB test saved as draft
      • Resend AB test
      • Delete AB test
    • RSS campaign
      • Create RSS campaign
      • Audience
      • Enable RSS campaign
      • RSS campaign report
    • Chrome plugin for Rocket push
    • Multi Push
    • Daily push capping
    • Planner
    • FAQ
  • Automation
    • Overview
    • Automation
      • Create automation
        • Name
        • Flow
        • Renew flow
        • Start date
        • End date
        • Building the flow
        • Step
          • Trigger
          • Campaign
            • Create campaign
            • Edit campaign
            • Campaign templates
      • Edit automation
        • Update automation
      • Report
        • Automation report
        • Campaign report
    • Automation list
      • Prority
      • Action
      • Status
      • Reset flow time
  • Analytics
    • Project analytics
      • Subscribers
      • Campaigns
      • Automation
    • Organization analytics
      • Organization dashboard
        • Subscribers
        • Campaigns
        • Automation
      • Project comparison
    • Exports
  • Integrations
    • Webhooks
    • REST API Reference
  • Release notes
Powered by GitBook
On this page
  • Overview
  • Setup
  • Basic Usage
  • Working with Beacons
  • Unsubscribing a Subscriber
  • Summary

Was this helpful?

  1. Web push

SDK Client

Our scripts expose SDK Client via `ppg.client` variable

PushPushGo Scripts expose a powerful SDK Client that allows you to customize the behavior and flow of notifications on your website. This guide will walk you through setup, registration, beacon usage, and subscription management using the SDK client.


Overview

The ppg.client object becomes available when the SDK Client is enabled and properly integrated. It provides functionality to:

  • Register and unregister subscriptions

  • Send custom data using beacons

This allows for advanced, programmatic control over how you interact with subscribers and track user behavior or actions.


Setup

  1. Integrate PushPushGo scripts into your website.

  2. Go to your PushPushGo Project Settings.

  3. Toggle "SDK Client" to the enabled state.

  4. Navigate to your website and open the browser console.

  5. You should now see the ppg.client object available globally:

console.log(ppg.client);

Basic Usage

Registering a Subscription

Use the register() method to create or retrieve a current subscription:

const subscriber = await ppg.client.register();

if (!subscriber) {
  console.log('No permission');
  return;
}

console.log('Permission granted');
console.log('Subscriber ID:', subscriber.id);

Working with Beacons

The SDK client allows you to send custom data through beacons—small, structured payloads that track events or attributes.

Using the Beacon Builder

You can send a beacon using a fluent builder interface:

await subscriber.send((beacon) =>
  beacon
    .appendLabel("test")
    .appendLabel("test2", "my_label", "append", 1234)
    .removeLabel("test", "default")
    .setCustomId("123")
    .setField("aaa", "bbb")
);

Using a Beacon Object Directly

Alternatively, you can build a beacon manually and send it:

const beacon = subscriber.beacon();

await beacon
  .appendLabel("test")
  .appendLabel("test2", "my_label", "append", 1234)
  .removeLabel("test", "default")
  .setCustomId("123")
  .setField("aaa", "bbb")
  .send();

Unsubscribing a Subscriber

To remove a subscriber from your notification list:

await subscriber.unsubscribe();

Summary

With PushPushGo's SDK Client, you gain fine-grained control over your web push notification subscriptions and event tracking. Use it to:

  • Seamlessly manage subscription lifecycles

  • Attach meaningful labels and data to subscriber actions

  • Integrate custom tracking and analytics via beacons

For more information, consult your project settings or contact PushPushGo support.

Last updated 15 hours ago

Was this helpful?