Dot Embed Library

The dot.vu embed library is our javascript library which will enable you to embed dot.vu’s experiences on your website.

The standard usage of the Embed Library is to simply embed a page on your website. However you can also use it to communicate back and forth between the dot.vu page and your website by using the Dot Embed Library Add-On.

There are several options for sending and retrieving information from the embedded dot.vu page. They are:

  • Initialise the dot.vu page with URL Data
  • Subscribe to triggered events
  • Get a session data fields value
  • Set a session data field value
  • Run a Custom Action

Bellow it is exemplified all possible use cases of the Dot Embed Library. What is important to note is that upon calling the load method a callback will be called, once the page is ready, with a Page instance. Once you have access to the Page instance you will be able to use it to handle events, actions and data fields.

// Dot.vu page's config
var config = {
  dotId: 155,
  pageId: '60ab77612d249b5070590e07',
  loading: 'on',
  height: 'auto',
  width: '100%',

  // optional url data to send to the page (requires URL Data Add-On)
  urlData: {
    customerId: '123',
  },
}

window.dotEmbed.load(el, config, function (page) {
  var events = page.events
  var actions = page.actions
  var datafields = page.datafields

  // Subscribe to triggered events.
  events.subscribe('new-lead', function (lead) {
    console.log(lead)
  })

  // Get a session data field value
  datafields.get('counter').then(function (value) {
    console.log(value)
  })

  // Set a session data field value
  datafields.set('counter', 10)

  // Run a custom action
  actions.run('showButton')
})

Updated on May 26, 2021

Was this article helpful?

Related Articles