Configuration and Settings

📘

Drift Privacy Policy

Drift respects privacy rights and data protection laws. You may only share other people's personal information with Drift, whether directly or through third-party integrations, if you are permitted to do so under applicable law. Drift Privacy Policy

With the API you can also control many aspects of the widget configuration. Call drift.config with one or more of the options described below to change the widget's configuration for that session.

First, Initialize the Drift Widget

<script>
drift.on('ready',function(api, payload) {
 // your code goes here
})
</script>
<script>
analytics.ready(function(){
    //your code goes here
})
</script>

Drift Config Example

<script>

  drift.config({
   locale: 'en-US',
    messages: {
     welcomeMessage: 'Hey there!',
      awayMessage: "Hey, we're not here right now, but leave a message.",
      emailCaptureMessage: "Leave your email so we can get back to you.",
      thankYouMessage: "Thanks we'll follow up soon."
    },
    enableWelcomeMessage: false,
    enableCampaigns: false,
    enableChatTargeting: false,
    backgroundColor: '#000000',
    foregroundColor: '#ffffff',
    autoAssignee: {
      name: 'Trevor Rundell',
      title: 'Engineer',
      email: '[email protected]',
      avatarUrl: 'https://s.gravatar.com/avatar/...',
    },
    inboxId: 99999,
    cookieDomain: '.example.com',
    disableNewConversations: true
  })
  
</script>

Configuration Options:

Configuration

Description

locale

An IETF language tag (usually a combination of language and country codes) overrides the language specified in your settings

enableWelcomeMessage

True will allow the welcome message popup to happen while you're online. false will prevent it from popping up. overrides the "show welcome message teaser" setting.

enableCampaigns

False will disable enrollment in / display of any browser targeted campaigns. Default is true.

enableChatTargeting

False will disable any chat targeting "display when" rules defined in your settings. Default is true.

backgroundColor

Overrides the primary (background) of the widget

foregroundColor

Overrides the primary (foreground) of the widget

autoAssignee

Sets the default user that is shown in all welcome messages. If you specify at the email field new conversations will automatically be assigned to the team member with that email address. Overrides any "helping team members" defined in your settings.

cookieDomain

Change the domain that the widget will read and write identification cookies from. Defaults to the current domain, but can be used to set cookies on a more generic domain instead.

inboxId

Override the default inbox for conversations created by the widget

messages

Override any custom messages set within the app. By default these will be set to the localized default for the selected locale. Note that these will not affect any messages sent by the bot.

welcomeMessage

Text shown on the welcome message popup.

awayMessage

Text shown on the away message popup

thankYouMessage

Text shown after the user has started a conversation via the away message.

emailCaptureMessage

Text shown on the lead email capture form.

disableNewConversations

Disallow site visitors from composing new messages via the compose button in the widget

Moving the widget vertically

This functionality can now be updated directly in the UI here. You can easily customize your mobile and desktop widget alignment to the left or right, then adjust the spacing from the bottom of the screen. For example, moving the widget up 70 pixels from the default spacing.

You may also use the verticalOffset property in your drift configuration to move {x} number of pixels from the bottom of the page.

<script>
  drift.config({
   verticalOffset: 70,
  })
</script>

Did this page help you?