How to test my Web Push integration?

Follow this guide to make sure Batch is integrated correctly into your website before going live.

Once you have completed the steps described in the web push integration guide, several elements should be checked to make sure you will be able to use Batch to its full potential.

There are two scenarios if you integrate web push:

Case A: The notification prompt is triggered correctly

Google Chrome native prompt

In this case, follow these steps:

1. Send a test push to your browser

Allow push notifications and try sending a test notification to your browser (repeat the same step on Chrome, Firefox, and Safari).

Here is how to do it: How can I send a test notification to my web browser?

2. Review your website icons

Ensure icons match the required size and format (see documentation).

In particular, make sure that the small icon has a transparent background and is properly displayed (i.e., not a gray circle) on Android.

Here is how to send a test notification to a web browser on Android.

3. Firefox and Safari custom alert (optional)

Safari pre-prompt notification authorization

If you choose to use Batch pre-permission prompts to set a custom alert on Firefox and Safari, ensure it is displayed when you land on the website and fits the custom UI that you want to display.

4. Custom User ID (optional)

User profile view highlighting Custom User ID value

If you choose to set up a Custom User ID, make sure it is sent to Batch when you log in to the website using the Profile view on the dashboard (Profiles > Search Profiles) and your Installation ID.

5. Language & Region (optional)

User profile view highlighting language and region values

If you choose to overwrite the default values detected by the SDK with the language displayed on the website for this user, you can check that it is updated correctly using the Profile view on the dashboard (Profiles > Search Profiles) and your Installation ID.

Case B: The permission prompt is not triggered on your website

In this case, check the following:

1. Clear the data stored for your website

Make sure you reset your browser preferences between each test: see how to do it here.

2. Staging domain name

Allowing staging domains section

If you deployed Batch on a staging version of your website, make sure your JavaScript tag contains the "dev: true" parameter and you added your staging domain name to the list of "Allowed dev origins", from the dashboard Settings > Channels > Website.

3. Dev mode

Javascript tag Higlighting dev:true parameter

If you deployed Batch in production, make sure you removed the "dev: true" parameter from the Javascript tag.

4. Service worker

Inspector section showing Batch service worker started

Make sure that the Service Worker is well integrated at the root of your website: type the name of the service worker after the domain name (e.g., mywebsite.com/batchsdk-worker-loader.js). You may have chosen to add the service worker in a subfolder, in which case the path must be indicated in the JavaScript tag (see documentation). In case you integrated it with an existing service worker, ensure you followed all steps of this documentation.

5. Unsecure environment

Unsecure website error message

Ensure that your test website is secure. For any service worker to work, it is essential to use HTTPS and to have an accepted/valid certificate (read more here).

Last updated

Was this helpful?