Web SDK
This FAQ part answers questions about WEB SDK and Web Events.
How can I define custom events through Web SDK?
The first step is to prepare the table where the events to be collected will be transferred. Once the table feeding the event is set up, you can trigger the custom event from either the website or mobile application based on the columns in the table, using the function below. The table opened should be of type 'Big Data Table.' Please check Tables section to learn about how to create Big Data Tables.
var eventData = {
event_name: 'purchase',
product_id: 12345,
product_name: 'computer'
};
dengage('sendDeviceEvent', 'events', eventData);
In the example provided: The term "'event_name'" represents the name of a column in the big data table you have opened. The value "'purchase'" next to it signifies the value to be fed into this column for the respective event. Thus, each column in the table you have created specifies a parameter in the JS code. The term "'events'" at the bottom line should denote the name of the table you have created.
For further information regarding custom events, you can refer to the technical documentation here: Custom Events Technical Documentation
Note: Upon creating the Big Data table, the 'key' and 'event_date' fields are automatically generated. When triggering events, it is unnecessary to send 'key' and 'event_date' within the function, as these two columns are populated by the SDK.
How can I implement Web SDK?
After creating and saving the website application (as outlined in the guide "How to create Web SDK and Service Worker File (SWF)?"), navigate to More > Setup Guide to access the Web SDK. Copy this code and insert it into the tag of every page on the website. This insertion can be done either through GTM or directly into the source code.
If there are subdomains where you wish to implement the Web SDK, ensure they are added to the application by clicking "+ Add Domain."
You can refer to the documentation here: Web Push SDK Setup Documentation
Identify contact
As detailed in the documentation, if your website includes a login function, it's necessary to implement "setContactKey" to facilitate matching between the device and the contact. The "contact key" serves as the unique identifier for contacts within the Dengage CDMP platform.
Double Service Worker File
If there exists a service worker file from another provider, it must be removed before adding the Dengage service worker file. Additionally, even after removing the service worker file, the push prompt might still appear due to settings from the previous provider. Ensure that these prompts are disabled so that only the Dengage SDK runs for displaying prompts and generating tokens.
Should we include the same SDK for our mobile site, considering that it operates on a separate domain?
Certainly, it's advisable to utilise distinct SDKs for each site. If the web URLs differ, we ought to establish separate web applications for both mobile and desktop websites.
Do we have the option to transmit our own device IDs for website visitors instead of relying on D-engage's device IDs?
To establish a connection between the user and the browser, you can assign the device ID. To assign your own device id, use the following syntax:
dengage('setDeviceId', your_device_id);
How to identify contacts through Web SDK
If your website includes a login function, it's necessary to implement "setContactKey" to facilitate matching between the device and the contact. The "contact key" serves as the unique identifier for contacts within the Dengage CDMP platform.Use the following syntax:
dengage('setContactKey', your_contact_id);
Since the mobile app essentially mirrors the content and functionality of the website, should I duplicate events in the app as well?
If your mobile app is a mobile screen sized view of your website and the events capturing script have already been added/Integrated in the website code then you do not need to add the the events script again for the mobile app
Updated 7 months ago