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:

ConfigurationDescription
localeAn IETF language tag (usually a combination of language and country codes) overrides the language specified in your settings
enableWelcomeMessageTrue 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.
enableCampaignsFalse will disable enrollment in / display of any browser targeted campaigns. Default is true.
enableChatTargetingFalse will disable any chat targeting "display when" rules defined in your settings. Default is true.
backgroundColorOverrides the primary (background) of the widget
foregroundColorOverrides the primary (foreground) of the widget
autoAssigneeSets 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.
cookieDomainChange 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.
inboxIdOverride the default inbox for conversations created by the widget
messagesOverride 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.
welcomeMessageText shown on the welcome message popup.
awayMessageText shown on the away message popup
thankYouMessageText shown after the user has started a conversation via the away message.
emailCaptureMessageText shown on the lead email capture form.
disableNewConversationsDisallow 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>

Moving the widget horizontally

Similar to moving the widget vertically, but this time we're going to move it horizontally using the horizontalOffset property.

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