Synchronous vs. Promise-Based Functions
Some functions return a value immediately, while others return a promise and must be awaited (or chained with.then()). If you use a promise-based function directly, you get back a Promise object instead of the value.
Functions that return a value immediately:
_aimtellCheckPermissions()_aimtellSupportsPush()_aimtellPrompt()_aimtellForcePrompt()
_aimtellGetSubscriberID()_aimtellGetPushToken()_aimtellGetSubscriberIDFromToken(token)_aimtellGetSubscriberAttributes()_aimtellGetNotifications()_aimtellMarkNotificationsRead(timestamp)_aimtellMarkNotificationsUnread(timestamp)_aimtellDeleteNotifications(timestamp)
Aimtell functions are only available once the script has finished loading. If you’re calling them on page load, do it from inside
_aimtellReady().Check Permissions
(str) - granted, default or denied
Example
Supports Push
(boolean)
Example
Get Subscriber ID
(str) subscriber id
Example
Get Push Token
(str) device token
Example
Resolves to
null if the visitor isn’t subscribed or the browser doesn’t support push.Get Subscriber ID From Token
token- required. browser push token
(obj) result, uid
Example
Get Subscriber Attributes
(obj) with idSite, subscriber_uid and custom_attributes. custom_attributes is an object of your tracked attribute name/value pairs, and is empty if none have been set.
Example
Show Push Prompt
null
Example
Force Push Prompt
null
“Previously denied” refers to the visitor dismissing your custom optin. If the visitor has already granted or denied permission at the browser level, this function does nothing. Browser permissions can only be changed by the visitor in their browser settings.
Example
Get Notifications
(array) of notification objects with the following fields:
title- notification titlebody- notification bodyicon- icon URLlink- destination URLread-(boolean)trueif read,falseif unreadtimestamp- used to target a single notification in the functions below
Example
Mark Notifications Read
timestamp to mark a single notification, or call with no arguments to mark all notifications as read.
Params:
timestamp- optional. Thetimestampvalue from a_aimtellGetNotifications()response item. Pass it through unchanged.
(obj) { updated: <count> }
Example
Mark Notifications Unread
timestamp to target one, or omit to mark all notifications as unread.
Params:
timestamp- optional. Thetimestampvalue from a_aimtellGetNotifications()response item. Pass it through unchanged.
(obj) { updated: <count> }
Example
Delete Notifications
timestamp to delete a single notification, or omit to delete all of the subscriber’s notifications.
Params:
timestamp- optional. Thetimestampvalue from a_aimtellGetNotifications()response item. Pass it through unchanged.
(obj) { deleted: <count> }

