You can use the JavaScript functions below to effectively manage the display of the subscription and action confirmation options (example: "You are a subscriber!") on your website.
* You will need the technical person responsible for your site to perform some of the steps in this article.
![]() | Have access to the code of your site. |
How to
Display the subscription request
Function that allows you to trigger the authorization request in your browser. Previously identified visitors who have allowed notifications in their browser will be eligible for web push.
- Integrate the subscription request on your website on a clickable element such as a button, an image, a link, etc.
We recommend that you let the visitor perform the action of requesting, instead of displaying the request automatically upon visit. - Add the following function:
The language code must be the 2 character code corresponding to the subscription language. This code is shown next to each language you have selected in the Configuration section (see Configuring the use of web push notifications).
Examples
Identify a contact
Function that lets you identify subscribers, if you already have data on them. For example, if your website allows visitors to connect to it, then you already have some information on them like their email, first name and last name.
It is also possible to identify subscribers to your project contacts by sending an email (via the injection rules) (see Identifying anonymous subscribers).
- Use the right information to call the following function:
- Replace f_FieldCode by the code of the field primary key. You can find this information in the article about configuring fields in your project.
- Replace Value by the value to search for in contact profiles in your project.
Examples
Check if a browser is supported
Function that checks if the browser supports web push and if it is supported by Dialog Insight.
Simply add:
Tip: Display the subscription request on your website only if the browser supports web push.
Check if the visitor has authorized notifications
Function that checks if the visitor has authorized web push in his browser.
Simply add:
Tip: Do not display the subscription request if the visitor is already a subscriber.
Check if the visitor has blocked notifications
Function that checks if the visitor has blocked web push on the website.
Simply add:
Tip: Do not offer web push if the visitor has blocked them.