The Web SDK is currently in Closed Beta testing. The public API and internal operations are subject to change while it is tested with qualified partners and in different web-technology environments.
- requires an isomorphic fetch polyfill (eg: node-fetch)
1. Installing the SDK
Add the supplied
lmgSDK.js file to your repository
The file is a Universal Module Definition so it can be used two ways:
<!-- HTML -->
const Client = require('./vendor/lmgSDK').Client;
Create an Integration Write Key
Create a new Integration for your app in the Property you're working with, and use the Integration Write Key to initialize the SDK (below).
See Enabling SDK Integrations for more details.
Initialize the SDK
The SDK must be initialized first thing, before calling any other methods.
const lmgClient = new Client(
|boolean||Should we ask the browser for the user's physical location?|
|boolean||Set to |
|Function||Fetch implementation to use for http requests. Required if running in nodejs|
|string||Level of events to log to the console.|
|Fine-grained information events. Used for debugging and should never be displayed in production.|
|Course application information that may be useful for debugging or in production logs.|
|Non-critical errors that were recovered from or have few major problems.|
3.Testing your integration
Run app. You should see following message in your log:
[RefreshOrCreateSession] Completed successfully
Note: This will only be logged when
logLevel is set to 'Debug' or 'Verbose'