• Features
  • API Docs
  • Help Center
  • Log in
  • Sign Up
  • Features
  • API Docs
  • Help Center
  • Log in
  • Sign Up

Web Push Prompt Settings in JS

103 views January 12, 2022 0

The process of implementing web push notifications is fairly straightforward: you will need to upload to your website a few lines of code to activate the feature.

Things to know before you start:

  • We strongly recommend using HTTPS, as browsers may block notifications from domains using the HTTP protocol. 
  • If you are not sure whether the website is on HTTP or on HTTPS, please ask your website administrator about it or contact our customer support.
  • Using raw device tokens for targeting specific devices is not the most reliable way, because FCM push tokens tend to change from time to time, and it’s hard to tell how often it occurs.

To Call Web Push Notification One-click Subscription Prompt on your website, you need to properly identify your user and fire an event on your web page.

IMPORTANT Include those snippets on every page in your app, immediately before the closing </body> tag to initialize JS API and identify your user.

Connecting the library:

<script type="text/javascript" src="//js.smartsender.io/js/v1/JS_SCRIPT_ID.js>

</script>

Contact identificator:

<script type="text/javascript">

    var contact = new_smartSenderContact('{{identifier}}');

</script>

Step-by-step instructions:

  1. Install JS API
  2. Create and generate a JS code snippet.
  3. Call “Show web push subscription prompt” modal API method:
<script type="text/javascript">

    contact.ShowPushPrompt();

</script>

 

Parameters
ShowPushPrompt();
'required'
Call Web Push Notification One-click Subscription Prompt on any page or by user action.

After inserting the code on your site, make your first JS API call and check the integration status.

  • Navigate to the Integrations page (Menu -> Integrations).
  • Select the “JS code” section.
  • When the first successful JS API call is done, the installation will be validated, and the status will change to “Connected.”
  • If the website status is “Not connected”, it is necessary to check the applied settings once again.
  • If the website status is “Connected”, you will be able to create and update contacts, manage their data and subscription.
Similar posting
  • Integration with Mailchimp
  • Zapier Integration
  • JS API methods
  • Add contact manually
  • How to fire event via JS
  • How to create and update contact via JS
Company
  • About us
  • Team
  • YouTube
  • Facebook
  • Google Business
Legal
  • Terms of Use
  • Privacy Policy
  • Anti-Spam Policy
  • Cookie Statement
Resources
  • Api Documentation
  • FAQ
  • Knowledge Base
  • SmartSender Blog
  • Marketplace

We use cookies to make SmartSender’s website a better place. Cookies help to provide a more personalized experience for you, and web analytics for us. To learn more, and to see a full list of cookies we use, check out our Cookie Policy (baked goods not included).

got it