Widget API: Setup

Updated 24 days ago ​by Matt Bilotti

If you'd like to use the customize the Drift widget beyond what is offered through our app, you can use our widget API to control aspects of our widget remotely. 

First, check that the Drift widget is initialized and ready for use.

The ready event indicates that Drift widget is ready for use. It contains a single argument which is the actual API object that can then be acted upon.

<script> 
drift.on('ready',function(api, payload) {
 // interact with the api here
})
</script>
Here is an example using our Widget API
Note for Segment Integration Users, follow along here to determine when the Drift API is ready for use
<script> 
analytics.ready(function(){
  drift.on('ready',function(api){
    // interact with the api here
  })
})
</script>


Here is a code example, showing how to customize our widget using our Widget API

The following snippet uses our hide and show widget functions  to hide the widget from users until they receive a message.

What Can You Customize With the Widget API: 

 

Not using Drift yet? Get your free account here.

Looking for our documentation on using Drift events

Was this article helpful?


Can’t find what you’re looking for?

Talk To Us