How do I Retrieve my Web Channel ID?

Troubleshooting implementation issues is much easier when we have the Device Identifier. This information is important (and usually required) when contacting Airship Technical Support with setup, web push delivery, implementation, segmentation, or registration issues. The Device Identifier helps Airship Technical Support find the device in the system and push logs; it is used to retrieve current device information in the system, as well as locate any previously sent web push notifications that were supposed to be delivered to the browser.

Ensure you are using a supported browser. See Supported Browsers for a complete list.

This article will walk you through the steps to reveal your web Channel ID as outlined in our Web Channel ID documentation. 

1/ Navigate to a page within your website that includes the Web Notify SDK.
The page where you registered to receive web push notifications should meet this criterion.


2/ Open the Javascript Console.
This step varies by browser and OS.

  • Using keyboard shortcuts:
    • Google Chrome, Microsoft Edge, Opera:
      • macOS: cmd +opt + J
      • Windows/ Linux: ctrl +shift + J
    • Mozilla Firefox:
      • macOS: cmd +opt + K
      • Windows/ Linux: ctrl +shift + K
    • Safari:
      • macOS: cmd +opt + I
      • Windows/ Linux: n/a
  • Using your mouse:
    • All browsers and OS: 
    1. Right-click anywhere on the page 
    2. Select Inspect or Inspect Element 
    3. Select the Console tab 

 

3/ Copy the following code:

Web v1:

UA.then(sdk => {console.log(sdk.channel.id)})

 

Web v2:

UA.then(sdk => sdk.channel.id()).then((channel) => console.log(channel))

 

4/ Paste the code into the prompt in the Javascript Console console_request.png

Figure 1 - Google Chrome's Javascript Console

 

 5/ Press enter/return to run the code. You will see one of the following responses:

    • If a browser has registered, the Channel ID will be returned. console_response.png

      Figure 2 - Channel ID is returned

    • The SDK will return null if the browser is unregistered. Only registered browsers will have a Channel ID. See our documentation on how to Register. console_null.png

      Figure 3 - Null response

    • A UA is not defined error can indicate that the SDK snippet is not present within the page. Navigate to a page on your site that does have the SDK snippet and repeat the steps above.
      console_no_sdk.png

      Figure 4 - UA is not defined error

Ideally, the SDK snippet will be present in every page on your site, as per the Add JavaScript Snippet section of our Web Getting Started guide. If, for testing or other reasons, you have added the snippet to just one page of your site, you will need to be on that specific page for the above to be successful.


Related Content:

Was this article helpful?
0 out of 1 found this helpful
Submit a request