Versions Compared
compared with
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Initialization
Method Objective
The method allows sending click tracking to the system, displaying a simple notification by the SDK, and sending the data necessary to track and display the notification to the user's methods via a callback.
Syntax and parameters
Code Block | ||
---|---|---|
| ||
pcsdk.initPush(click, receive, background_receive); |
Name | Type | Requirement | Description |
---|---|---|---|
click | function/boolean | optionally | Custom function to send a notification click event. If not used or has the false value, SDK will send click tracking by itself. |
receive | function/boolean | optionally | Custom function to show the notification. If not used or has the false value, SDK will show basic notification by itself. |
background_receive | function | optionally | Custom function to show a notification in the background. If not used, the SDK will show a basic notification by itself. |
Data for Callback Functions
Callback Name | Data Format | ||
---|---|---|---|
click |
| ||
receive |
| ||
background_receive |
Examples of use
Code Block | ||||
---|---|---|---|---|
| ||||
// Click tracking and showing the simple notification by the SDK pcsdk.initPush(); // Custom method for click tracking, but showing simple notification by the SDK pcsdk.initPush(onClickCallback); // Click tracking and showing simple notification by the SDK, but showing notification by custom method for background mode pcsdk.initPush(false, false, onBackgroundReceiveCallback); // Click tracking by the SDK, but showing notifications including in the background by custom methods pcsdk.initPush(false, onReceiveCallback, onBackgroundReceiveCallback); // Click tracking and showing notifications including in the background by custom methods pcsdk.initPush(onClickCallback, onReceiveCallback, onBackgroundReceiveCallback); |
Token Send
Code Block | ||||
---|---|---|---|---|
| ||||
pcsdk.setPushTokenNotification('NEW_TOKEN'); |
Actions Tracking
Code Block | ||||
---|---|---|---|---|
| ||||
const params = { code: 'CODE', type: 'TYPE' }; // Track user click notification pcsdk.notificationClicked(params); // Track Notification received pcsdk.notificationReceived(params); |
Table of Contents | ||||
---|---|---|---|---|
|