For now, we support only Google Chrome extensions.
Analytics
MoEngage supports only the analytics channel in extensions for now. You can track events attributes and user identities.Permissions
No additional permissions are required in yourmanifest.json when integrating the MoEngage SDK as a local file bundled with your extension.
Since the Google Chrome extension does not allow to fetch a script from an external URL, you must make a local copy of the script and place it in your project folder.
For WebPush Notification Support in Chrome Extension, “notification” permission is required.
Getting Started
Before you get started, ensure that you have read the Initial SDK setup guide of Web SDK to learn more about our JavaScript integration in general.
| Dashboard Host | CDN URL |
|---|---|
| dashboard-01.moengage.com | https://cdn.moengage.com/release/dc_1/moe_webSdk.min.latest.js |
| dashboard-02.moengage.com | https://cdn.moengage.com/release/dc_2/moe_webSdk.min.latest.js |
| dashboard-03.moengage.com | https://cdn.moengage.com/release/dc_3/moe_webSdk.min.latest.js |
| dashboard-04.moengage.com | https://cdn.moengage.com/release/dc_4/moe_webSdk.min.latest.js |
| dashboard-06.moengage.com | https://cdn.moengage.com/release/dc_6/moe_webSdk.min.latest.js |
moe_webSdk.min.latest.js file somewhere into your extension’s directory.
Extension Pop-Up Windows
To add MoEngage SDK to an extension pop-up window, reference the local JavaScript file in yourpopup.html, as you would on a regular website.
Initialization
After adding MoEngage SDK to an extension pop-up window, you can initialize the library as usual. Because cookies are not supported in browser extensions, you can disable cookies by initializing withdisableCookies: true.
Web Push Integration
To enable Web Push Notifications in the Chrome extension, ensure you have performed the SDK integration steps and that the SDK is working properly.Permissions
Notification Permission is required with manifest_version: 3 in the manifest.json file.
Integration
To enable Web Push in your extension, you must first download a copy of the latest service worker file. You can do this by downloading it directly from MoEngage CDN. Find the CDN script based on your dashboard host. Right-click and download to save the file.| Dashboard Host | CDN URL |
|---|---|
| dashboard-01.moengage.com | https://cdn.moengage.com/release/dc_1/versions/2/serviceworker_chrome_ext_cdn.js |
| dashboard-02.moengage.com | https://cdn.moengage.com/release/dc_2/versions/2/serviceworker_chrome_ext_cdn.js |
| dashboard-03.moengage.com | https://cdn.moengage.com/release/dc_3/versions/2/serviceworker_chrome_ext_cdn.js |
| dashboard-04.moengage.com | https://cdn.moengage.com/release/dc_4/versions/2/serviceworker_chrome_ext_cdn.js |
| dashboard-06.moengage.com | https://cdn.moengage.com/release/dc_6/versions/2/serviceworker_chrome_ext_cdn.js |
serviceworker_chrome_ext_cdn.js file into your background.js extension’s file and make sure the file is linked to your service_worker inside manifest.json.
Please take a look at the sample project for better understanding.