Web SDK Integration Guide
This document is a standard integration guide for the MA Web SDK.
Preparations before Integration
- To use the EngageLab MA service, you need to integrate the WebPush module first.
- Prepare an accessible HTTPS web service domain name. After integration, the pages need to be tested and debugged under this domain name. Web offline push does not support local debugging and HTTP.
- Access Engagelab WebPush, and on the [Integration Settings] - [Website Domain Name] page, fill in the HTTPS web service domain name.
Product Description
The MA module in the EngageLab Web SDK provides data collection and reporting functions, which are used in scenarios such as EUID generation, user property setting, and event reporting.
Main Scenarios:
Set various types of properties and report various types of events.
Obtain Application Information
You need to create an application on the WebPush console. After successful creation, an AppKey will be automatically generated to identify this application. For details, refer to the Application Settings Document.
SDK Access
Go to the Console, download the SDK, and access the JavaScript on each page:
<script type="text/javascript" src="./webPushSdk.min.3.0.0.js"></script>
Tips
After importing this JavaScript, pass the maOpen
property with a value of true
to enable the MA configuration, and then you can use the relevant APIs and functions of MA.
SDK Initialization
// Initialize (enable MA)
MTpushInterface.init({
appkey: "", // Required. See the above section on obtaining application information.
user_str: "adminDemo", // Required. User identifier used to identify the user.
swUrl: '', // Default is "/sw.min." + sdkEnv.version + ".js". This configuration item is the address of the server worker file. The domain name must be the current domain name, and the path determines the scope of the server worker.
maOpen: true, // Turn on the switch to enable the MA function.
debugMode: boolean; // Set whether to enable debug mode. If true, more log information will be printed. If set to false, only logs of levels w and e will be output.
channel: string; // Channel name. The default value is: default-channel.
appName: string; // Used to set the website name for reporting.
});
More APIs
For the usage of other APIs, please refer to the interface documentation: Web SDK API.