Testing your integration

SDK Development mode

As you have probably noticed, a dev: true configuration parameter that has been added by default on the JavaScript snippet suggested on the dashboard.

This allows you to test your implementation on domains declared in the "Allowed dev origins" field in the "Settings > Push settings" section of your dashboard.

Allowed dev origins

It is essential that you remove this parameter in production, as it will prevent the SDK from working on your live domain.

If your created a specific app on Batch dashboard, dedicated to development purposes, you won't need to use the dev parameter. Make sure you go live with the keys of you production app.

Development environments

While developing your website locally, or deploying it to a staging environment, you might find that the SDK doesn't work in fully secure mode.

This is because you might not have been through the hassle of securing your local dev environment on your staging.

You've got two ways to fix this:

  • If your local dev environment uses a "fake" domain (such as "mywebsite.local"), you'll have to issue a self signed certificate
  • Fall back on the HTTP mode during development/staging. We advise against this, as unexpected issues can arise in production.

If you develop your website on your computer but access it though http://localhost, most browsers will treat it as fully secure, as this is URL is considered secure for convenience. You should test in an environment closer to your production one before releasing your update.

Showing public identifiers

2.2.0 A modal can be shown on your website to display the following identifiers:

  • Installation ID
  • Custom User ID
  • Push subscription status
  • Registration Token
batchSDK('ui.showPublicIdentifiers')

Public identifiers modal screenshot

Finding your ID

You can find the Installation ID of your device by calling:

batchSDK((api) => { 
  api.getInstallationID().then((id) => {
    console.log(id) 
  }) 
})

This example directly prints it to your browser's debug console.

Tip: In development mode, Batch already prints the installation ID to the console.

2.2.0 You can also trigger a modal that displays your Installation ID and your Custom User ID: Showing public identifiers.

Log your configuration tag

You can log the web push configuration tag in your browser's console by calling:

batchSDK((api) => { 
  console.debug(api.getConfiguration()) 
})

Debug tool

Batch provides a simple debug tool that allows you to test your integration (⚙ Settings → Debug), and send yourself test notifications.

It also shows all the data available for a specific user ID:

  • Token: Find the token of a specific device.
  • Custom user ID: Check if your custom user ID implementation is working correctly.
  • Native attributes: See the installation date, last session date, country and more information on a specific user / install.
  • Custom data: If you send additional data on your users through the Custom Data API.

Debug tool

Common issues and integration checklist

If you encounter any issue during your testing, you will likely find an answer in this guide: How can I test my web push integration?.

It also provides a comprehensive checklist of all elements you should review before going live.