Every campaign in Subcontext (CRM, Campaigns) counts the leads, quotes and sales it brings in, and what they cost. When someone starts a chat, a quote or an enquiry on your website, Subcontext works out which campaign it belongs to. You can tell it, page by page, with one setting on the embed.
Naming a campaign on an embed#
Give the embed the campaign's key. It's on the campaign's page, and the campaign's Capture tab shows the line to copy. The setting has the same name on every embed:
| Embed | On the snippet | From JavaScript |
|---|---|---|
| Webchat | data-campaign="spring-mortgage" |
SubcontextWebchat.init({ campaign: 'spring-mortgage' }) |
| Quote form | data-campaign="spring-mortgage" on the placeholder |
Subcontext.Quote.init({ campaign: 'spring-mortgage' }) |
| Form guide | data-campaign="spring-mortgage" |
SubcontextFormGuide.attach({ campaign: 'spring-mortgage' }) |
| Lead form | data-campaign="spring-mortgage" on a form's <div> |
Subcontext.leadform.init({ campaign: 'spring-mortgage' }) |
<script src="https://js.subcontext.com/webchat-latest.js" defer
data-agent-id="YOUR_AGENT_ID" data-campaign="spring-mortgage" crossorigin="anonymous"></script>
- A quote form passes its campaign on to the webchat and form guide it opens, unless you give them their own.
- The key is sent with the chat, quote or lead, as
campaignin where the visitor came from. Capital letters and spaces at either end are ignored. - A key that isn't one of your campaigns is ignored, and the lead is credited as if you hadn't set one. Nothing on the page changes.
Which campaign wins#
Subcontext takes the first of these that names a campaign that is taking leads:
- A campaign that claims the visit's
utm_campaign. On a campaign's Settings, UTM campaign values lists theutm_campaignvalues that count towards it. A visitor who arrives on?utm_campaign=springcounts towards the campaign that listsspring. - The form behind it. The lead form the visitor filled in, the quote form's campaign (from its key), or, for a chat about a quote, the quote's campaign.
- The campaign the embed names, with
data-campaignorcampaign. - The channel's campaign. On an agent's Channels, each channel's Campaign for new leads. For the webchat that's the Web channel, and for the form guide the Form guide channel.
A campaign that is paused or archived is passed over, and the next one in the list is used. If none is left, the chat or quote still goes ahead, credited to no campaign.
What it means for each embed#
- Webchat and form guide. The person who starts the chat counts towards the campaign once they're a lead, and quotes they start in the chat are credited to it.
- Quote form. The quote is credited to the campaign. On your Subcontext website's quote pages, the site's chat agent's Web channel is the last step.
- Lead form. The lead is filed on the campaign, so that campaign's rules
for which leads it accepts, and its price per lead, apply. The form's own
campaign comes before the embed's setting, so
data-campaignonly counts while the form's campaign is paused. A paused form usually shows that it isn't taking enquiries anyway.
Someone already on a campaign stays on it. If they come back through another campaign's page, they join that campaign as well, and their main campaign doesn't change.
Leads from your server#
When you send leads with the API, name the campaign with campaign in the
request. See Leads.