Web SDK Setup

This part explains how to setup D·engage Web SDK for your web site. Please follow the steps explained below to create Web SDK to embed with your site.

1.1 Creating a web application

You can create a web application on Settings > Applications page using Add button.

After filling input parameters and pressing save button, you must get the code snippet which is generated for your site and place it into your web site’s html code.

1.2 Using user information

If a user logs in (or you already have contact_key for that user), you can set contact_key in order to set the user information in the browser. There are two functions for getting and setting contact_key.

Please set contact_key whenever you have it in our Web SDK.

dengage('setContactKey', userId);

dengage('getContactKey', function(userId) {
     //use userId (contact_key) here
});

1.3 Send device (browser) specific events

You can use sendDeviceEvent function for sending events for the browser. Event are sent to a big data table defined in your D·engage account. That table must have relation to the master_device table.

If you set contact_key for that browser. Collected events will be associated for that user.

Note: Please check Event Collection/E-Commerce Events section to send specific e-commerce events to our platform. The example below sends a specific event to a specific custom big table created on our platform (for instance for a specific need. Please note that D·engage platform is also a CDP!

dengage(‘sendDeviceEvent’, tableName, dataObject [, callback]);

// for example if you have a table named "events"
// and events table has "key", "event_date", "event_name", "product_id" columns
// you just have to send the columns except "key" and "event_date", because those columns sent by the SDK

var eventData = {
  event_name: 'page_view',
  product_id: '12345'
};
dengage('sendDeviceEvent', 'events', eventData);