Push to Subscriber ID
You can assign a unique ID against each subscriber as mentioned in the example. The value
here refers to the subscriber ID stored at your end.
Definition
You will have to include the following piece of code after the iZooto has been initialized but before the JS call. Click here for sample code.
window._izq.push(['add_property',{
name : 'subscriber_id',
value : '{YOUR_SUBSCRIBER_ID_GOES_HERE}'
}]);
Parameters
Name | Description | Type | Required |
---|---|---|---|
value | ID to be passed against the user | String | Yes |
Sample Code
// iZooto Initialization
<script> window._izq = window._izq || [];
window._izq.push(["init" ]); </script>
/* Register Subscription Callback - Will only assign a subscriber ID if a
user subscribers to receive notifications. */
<script>
window._izq.push(["registerSubscriptionCallback",function(obj){
if(obj.statuscode==1) // User Status = Subscribed
{
// Subscriber ID Code
window._izq.push(['add_property',{
name : 'subscriber_id',
value : '0123abcdef987'
}]);
}
}]);
</script>
// JS Call
<script src="https://cdn.izooto.com/scripts/83600dbdd34d91e3b153aaf01a445e32dc49e63b.js"></script>
The above code assigns subscriber ID 0123abcdef987 to the subscriber. You can pass subscriber IDs for all the website visitors. However, a fraction of these visitors would actually subscribe to notifications. iZooto stores IDs only for the subscribers, not for all the website visitors. You would obviously need to know which all of these visitors actually subscribed to notifications. You may use the callback function defined below to find out subscribers.
In order to enable the functionality of assigning Subscriber ID to your visitors, please raise a request to [email protected]
API To Push Notifications
This API can be used to send a notification to an individual subscriber against a subscriber ID.
curl -X POST \
- H "Authentication-Token: {API_TOKEN}" \
- H "Content-Type: application/json" \
-d '{
"campaign_name" : "{CAMPAIGN_NAME}",
"title" : "{NOTIFICATION_TITLE}",
"message" : "{NOTIFICATION_MESSAGE}",
"icon_url" : "{ICON_URL}",
"badge_icon_url" : "{BADGE_ICON_URL}",
"banner_url" : "{BANNER_URL}",
"landing_url" : "{LANDING_URL}",
"actions" : [
{
"text" : "{BUTTON_1_TEXT}",
"url" : "{BUTTON_1_URL}",
"icon" : "{BUTTON_1_ICON}"
},
{
"text" : "{BUTTON_2_TEXT}",
"url" : "{BUTTON_2_URL}",
"icon" : "{BUTTON_2_ICON}"
}],
"utm_source" : "{UTM_SOURCE}",
"utm_medium" : "{UTM_MEDIUM}",
"utm_campaign" : "{UTM_CAMPAIGN}",
"req_interaction" : {true/false},
"override_tag" : "{CAMPAIGN_TAG_NAME}",
"ttl" : {TTL_SECONDS},
"target" : {
"type" : "subscriber_id",
"value" : "{SUBSCRIBER_ID_OF_THE_SUBSCRIBER}"
}
}' "https://apis.izooto.com/v1/notifications"
Parameters
Name | Description | Type | Required | Supported On |
---|---|---|---|---|
Authentication-token | API token for your site | String | Yes | |
Campaign Name | Campaign Title | String | Yes | Web Push: App Push: |
Title | Notification Title | String | Yes | Chrome, |
Message | Message on Notification | String | Yes | Chrome, |
icon_url | Notification icon URL | String | Yes | Chrome, |
badge_icon_url | Badge icon URL | String | No | Web Push: App Push: |
banner_url | URL of banner image | String | No | Only Chrome 56+ |
landing_url | Landing Page URL | String | Yes | Chrome, |
actions > text | Button Text | String | No | Only Chrome 48+ |
actions > url | Button Landing URL | String | No | Only Chrome 48+ |
actions > icon | Button Icon URL | String | No | Web Push: App Push: |
utm_source | UTM Source | String | No | Chrome, |
utm_medium | UTM Medium | String | No | Chrome, |
utm_campaign | UTM Campaign | String | No | Chrome, |
req_interaction | Make Notifications Sticky | Boolean | No | Web Push: |
override_tag | Show Latest Campaign Tag | String | No | Web Push: |
ttl (time-to-live) | Notification expiry time | Numeric (seconds) | No | Chrome, |
subscriber_id | ID of subscriber | String | Yes |
Sample API Code
curl -X POST \
- H "Authentication-Token: abc123efgh456ijklmn9786" \
- H "Content-Type: application/json" \
-d '{
"campaign_name" : "Test Campaign"
"title" : "Limited Period Offer",
"message" : "Go Shopping, Save Big",
"icon_url" : "https://yourdomain.com/icon.png",
"badge_icon_url" : "https://yourdomain.com/badge_icon.png",
"banner_url" : "https://yourdomain.com/large-image.png",
"landing_url" : "https://yourdomain.com/offers",
"actions" : [
{
"text" : "Buy Now",
"url" : "https://yourdomain.com/buy-now",
"icon" : "https://yourdomain.com/button_1_icon.png"
},
{
"text" : "Compare",
"url" : "https://yourdomain.com/compare",
"icon" : "https://yourdomain.com/button_2_icon.png"
}],
"utm_source" : "izooto",
"utm_medium" : "push_notification",
"utm_campaign" : "promotion",
"req_interaction" : true,
"override_tag" : "My Tag",
"ttl" : 86400,
"target" : {
"type" : "subscriber_id",
"value" : 8567891900
}
}' "https://apis.izooto.com/v1/notifications"
Updated 11 months ago