Skip to main content

Documentation Index

Fetch the complete documentation index at: https://developers.aimtell.com/llms.txt

Use this file to discover all available pages before exploring further.

_aimtellCheckPermissions()

Description: Checks visitor’s push notification permissions Params: N/A Response: (str) - granted, default or denied

_aimtellSupportsPush()

Description: Checks to see if visitor’s browser supports push notifications Params: N/A Response: (boolean)

_aimtellGetSubscriberID()

Description: Grabs the active visitor’s subscriber id. If none exists, one is generated. Params: N/A Response: promise, (str) subscriber id

Example

_aimtellGetSubscriberID().then(function(id) { console.log(id) })

_aimtellGetPushToken()

Description: Pulls the device push token from the current visitor. This is delivered as a javascript promise. Params: N/A Response: promise, (str) device token

Example

_aimtellGetPushToken().then(function(token) { console.log(token) })

_aimtellGetSubscriberIDFromToken(token)

Description: Grabs visitors subscriber id based on push token Params:
  • token - required. browser push token
Response: promise, (obj) result, uid

Example

_aimtellGetSubscriberIDFromToken(token).then(function(user){ console.log(user) })

_aimtellGetSubscriberAttributes()

Description: Grabs current website subscriber’s attributes.
Note: As custom attributes may contain information which an Aimtell website owner may not want easily viewable, this function by default is locked as a security measure. You must specifically request our team to unlock it for your account.

Example

_aimtellGetSubscriberAttributes().then(function(data){console.log(data)})

_aimtellPrompt()

Description: If custom push prompt exists, show it, else load native push prompt Params: N/A Response: null

_aimtellForcePrompt()

Description: Force shows the custom optin, even if previously denied. Params: N/A Response: null

_aimtellGetNotifications()

Description: Returns the subscriber’s notifications, most recent first. Params: N/A Response: promise, (array) of notification objects with the following fields:
  • title - notification title
  • body - notification body
  • icon - icon URL
  • link - destination URL
  • read - (boolean) true if read, false if unread
  • timestamp - used to target a single notification in the functions below
Requires _at.idSite and _at.subscriber to be set (the standard Aimtell init).

Example

_aimtellGetNotifications().then(function(notifications){
  // [{ title, body, icon, link, read: true|false, timestamp }, ...]
});

_aimtellMarkNotificationsRead(timestamp)

Description: Marks notifications as read. Pass a timestamp to mark a single notification, or call with no arguments to mark all notifications as read. Params:
  • timestamp - optional. The timestamp value from a _aimtellGetNotifications() response item. Pass it through unchanged.
Response: promise, (obj) { updated: <count> }
Requires _at.idSite and _at.subscriber to be set (the standard Aimtell init).

Example

// mark all as read
_aimtellMarkNotificationsRead().then(function(res){
  // { updated: <count> }
});

// mark one as read
_aimtellMarkNotificationsRead(1711900000).then(function(res){
  // { updated: 1 }
});

_aimtellMarkNotificationsUnread(timestamp)

Description: Marks notifications as unread. Pass a timestamp to target one, or omit to mark all notifications as unread. Params:
  • timestamp - optional. The timestamp value from a _aimtellGetNotifications() response item. Pass it through unchanged.
Response: promise, (obj) { updated: <count> }
Requires _at.idSite and _at.subscriber to be set (the standard Aimtell init).

Example

// mark all as unread
_aimtellMarkNotificationsUnread().then(function(res){
  // { updated: <count> }
});

// mark one as unread
_aimtellMarkNotificationsUnread(1711900000).then(function(res){
  // { updated: 1 }
});

_aimtellDeleteNotifications(timestamp)

Description: Deletes notifications. Pass a timestamp to delete a single notification, or omit to delete all of the subscriber’s notifications. Params:
  • timestamp - optional. The timestamp value from a _aimtellGetNotifications() response item. Pass it through unchanged.
Response: promise, (obj) { deleted: <count> }
Requires _at.idSite and _at.subscriber to be set (the standard Aimtell init).

Example

// delete all
_aimtellDeleteNotifications().then(function(res){
  // { deleted: <count> }
});

// delete one
_aimtellDeleteNotifications(1711900000).then(function(res){
  // { deleted: 1 }
});