Queries for Influenced By Drift

How does Drift calculate its Salesforce metrics?

On your dashboard, you can see the revenue impact of Drift. In short, influenced by Drift represents all the accounts that have had conversations with you using Drift chat before they closed.

Here's a breakdown of the Salesforce queries we use to calculate these numbers so you can run them yourself:

<START DATE> is the start of the query date range
<END DATE> is the end of the query date range

INFLUENCED OPPORTUNITIES (count and amount)

First query to get influenced accounts, and the first time it was influenced:

select AccountId, MIN(CreatedDate)
  from Task
  where
    Subject like '%Conversation in Drift' and
    AccountId != null and
    AccountId in (
      Select AccountId
      from Opportunity
      where
        DAY_ONLY(CreatedDate) >= <START DATE> and
        DAY_ONLY(CreatedDate) <= <END DATE>)
  group by AccountId

Second query to get influenced amounts and counts:

 select AccountId, COUNT(Name), SUM(Amount), DAY_ONLY(CreatedDate), CloseDate
  from Opportunity
  where
    DAY_ONLY(CreatedDate) >= <START DATE> and
    DAY_ONLY(CreatedDate) <= <END DATE> and
    AccountId in (<ACCOUNT IDS FROM THE FIRST QUERY>)
  group by DAY_ONLY(CreatedDate), AccountId, CloseDate

The results of the second query are filtered to those where the first conversation Task is before the Opportunity closed.

Amounts and counts are grouped by day and summed

CLOSED OPPORTUNITIES (count and amount)

First query to get influenced accounts that closed won, and the first time it was influenced:

select AccountId, MIN(CreatedDate)
  from Task
  where
    Subject like '%Conversation in Drift' and
    AccountId != null and
    AccountId in (
      Select AccountId
      from Opportunity
      where
        IsWon = True and
        CloseDate != null and
        CloseDate >= <START DATE> and
        CloseDate <= <END DATE>)
  group by AccountId

Second query to get amounts and counts:

  select AccountId, COUNT(Name), SUM(Amount), DAY_ONLY(CreatedDate), CloseDate
  from Opportunity
  where
    IsWon = True and
    CloseDate != null and
    CloseDate >= <START DATE> and
    CloseDate <= <END DATE> and
    AccountId in (<ACCOUNT IDS FROM THE FIRST QUERY>)
  group by CloseDate, AccountId, DAY_ONLY(CreatedDate)

The results of the second query are filtered to those where the first conversation Task is before the Opportunity closed.

Amounts and counts are grouped by day and summed

Queries for Influenced By Drift


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.