Chat Icon/Widget

Use Case

If you're on the Personal plan and do not currently have the ability to use "Display When" targeting, you can hide or show the Drift chat icon using these API Commands.

hide() and show()

api.widget.hide() hides the widget.

api.widget.show() shows the widget.

Example

The example below shows how to the default state of the Chat Widget to hide. Only when the Window is wider than 780 does the widget show.

<script>
drift.on("ready", api => {
 api.widget.hide()
 
 if (window.innerWidth >= 780) {
  api.widget.show()
 }
  
})
</script>

Not using Drift yet? Get your free account here!

Chat Icon/Widget