How to Integrate 6sense with Your Headless CMS
Connect 6sense account intelligence to your headless CMS so high-fit visitors see the right landing pages, offers, and sales paths based on buying stage, intent, and segment.
What is 6sense?
6sense is an account-based marketing and revenue intelligence platform used by B2B marketing, demand generation, and sales teams. It identifies anonymous website traffic, scores accounts, tracks intent signals, and helps teams build segments for advertising, personalization, and sales outreach. It sits in the Marketing & Advertising category because teams use it to decide which accounts to target, what message to show, and when to hand interest to sales.
Why integrate 6sense with a headless CMS?
If your website treats every visitor the same, you're leaving 6sense data outside the place where it matters most. A visitor from a target account in a late buying stage shouldn't see the same hero, proof points, and CTA as a student, competitor, or early-stage researcher. Connecting 6sense to a headless CMS lets your site use account fit, industry, segment, and buying stage to choose content at request time or publish time.
Architecture overview
A typical Sanity and 6sense integration has two flows. First, on the content side, marketers publish a landing page or offer in Sanity Studio with fields such as 6sense segment ID, industry, buying stage, campaign ID, canonical URL, and fallback CTA. A Sanity webhook fires on publish, or a Sanity Function runs on the mutation. The handler uses GROQ to fetch the published document and its referenced assets, product data, campaign metadata, and localization fields from the Content Lake. It then calls your 6sense API endpoint, usually the tenant endpoint provided in the 6sense Developer Portal or by 6sense Support, to register or update the content metadata used by your personalization, campaign, or custom activity workflow. Second, on the visitor side, your site loads the 6sense Web Tag or calls the 6sense Company Details API from a server route. The response identifies account attributes such as company, domain, industry, segment membership, fit, and buying stage. Your front end then queries Sanity for the matching content variant, renders it, and falls back to default content when 6sense doesn't return a match.
Common use cases
Account-based landing pages
Show different hero copy, customer proof, and CTAs for visitors in specific 6sense segments, such as enterprise manufacturing accounts in a decision-stage segment.
Buying-stage content paths
Map 6sense buying stages to Sanity content variants so early-stage accounts see educational guides while late-stage accounts see demos, pricing paths, and sales CTAs.
Industry-specific personalization
Use 6sense firmographic data, such as industry and company size, to select industry pages, case studies, and product modules from structured content in the Content Lake.
Campaign metadata sync
Send published campaign pages, offers, and URLs from Sanity to your 6sense workflow so advertising and web personalization use the same taxonomy.
Step-by-step integration
- 1
Set up 6sense access
Create or use an existing 6sense account, install the 6sense Web Tag on your site, and request API access from the 6sense Developer Portal or your 6sense account team. Confirm your tenant base URL, API key or bearer token format, allowed IP ranges, and the endpoints enabled for your package, such as Company Details, Segments, or Custom Activities.
- 2
Model the campaign fields in Sanity Studio
Add schema fields for the data 6sense needs: page URL, campaign ID, 6sense segment ID, target industry, target account tier, buying stage, fallback CTA, and personalization variants. Keep these as typed fields and arrays, not pasted JSON, so editors can work safely and GROQ can query them directly.
- 3
Create the publish trigger
Use a Sanity webhook filtered to published campaign documents, or create a Sanity Function that runs on create, update, and delete mutations. Include the document ID and dataset in the payload so the handler can fetch the full document from the Content Lake before calling 6sense.
- 4
Call 6sense from server-side code
In the handler, use @sanity/client and GROQ to fetch the exact fields for the page and any referenced assets. Then call your enabled 6sense REST endpoint with the page URL, segment IDs, campaign metadata, and status. Keep the 6sense token in environment variables, not in Sanity Studio or browser code.
- 5
Build the personalized front end
On the website, load the 6sense Web Tag or call the Company Details API from a server route. Use the returned account attributes to request the right content variant from Sanity, then render a fallback variant when the visitor can't be identified.
- 6
Test with real segment scenarios
Test at least three cases: a known target account, a known non-target account, and an anonymous visitor. Verify that Sanity publish events reach 6sense, the front end chooses the expected variant, and default content appears when 6sense doesn't return segment data.
Code example
import {createClient} from '@sanity/client';
const sanity = createClient({
projectId: process.env.SANITY_PROJECT_ID!,
dataset: process.env.SANITY_DATASET!,
apiVersion: '2025-01-01',
token: process.env.SANITY_READ_TOKEN!,
useCdn: false
});
export default async function handler(req: Request) {
const {documentId} = await req.json();
const page = await sanity.fetch(`
*[_id == $id][0]{
_id,
title,
"url": slug.current,
campaignId,
sixsenseSegmentId,
buyingStage,
targetIndustries,
"assetUrl": heroImage.asset->url
}
`, {id: documentId});
if (!page?.sixsenseSegmentId) {
return Response.json({skipped: true});
}
const res = await fetch(`${process.env.SIXSENSE_API_BASE_URL}/v3/activities`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.SIXSENSE_API_TOKEN}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
activityType: 'content_published',
campaignId: page.campaignId,
segmentId: page.sixsenseSegmentId,
url: `https://www.example.com/${page.url}`,
title: page.title,
buyingStage: page.buyingStage,
industries: page.targetIndustries,
assetUrl: page.assetUrl
})
});
if (!res.ok) throw new Error(`6sense sync failed: ${res.status}`);
return Response.json({synced: true});
}How Sanity + 6sense works
Build your 6sense integration on Sanity
Sanity gives you the structured content foundation, real-time event system, and flexible APIs to connect 6sense account intelligence with the content your buyers see.
Start building free →CMS approaches to 6sense
| Capability | Traditional CMS | Sanity |
|---|---|---|
| Account-based content fields | Often stores campaign copy inside pages, which makes segment IDs, buying stages, and industry targeting hard to reuse. | Models 6sense segment IDs, buying stages, industries, CTAs, and fallbacks as typed schema fields in Sanity Studio. |
| Sync on publish | Usually depends on plugins, scheduled exports, or manual updates to keep marketing systems current. | Webhooks and Functions can run server-side sync logic on content mutations, with no separate worker service required for common cases. |
| Field-level data control | Integrations often receive rendered HTML or large page payloads, so teams have to clean up data before sending it to 6sense. | GROQ can fetch exactly the fields 6sense needs, including joins across references, in a single query. |
| Personalization fallback handling | Fallback content is often hard-coded into templates or duplicated across pages. | Editors can create default, segment-specific, and industry-specific variants in one structured document, then preview them in the front end. |
| Multi-channel campaign reuse | Campaign content is usually tied to web pages, so email, ads, sales, and AI agents need copied versions. | The same structured content can feed web, mobile, 6sense workflows, sales tools, and production AI agents through Agent Context. |
| Implementation trade-off | Faster if you only need one static landing page and no account-based variants. | Best when you need structured targeting rules, real-time sync, and custom editorial workflows. It does require schema planning up front. |
Keep building
Explore related integrations to complete your content stack.
Sanity + Google Ads
Sync campaign landing page metadata and UTM-ready content from Sanity into paid search workflows.
Sanity + HubSpot
Connect Sanity landing pages, forms, and offers with HubSpot lead capture and lifecycle reporting.
Sanity + Marketo
Use structured campaign content from Sanity in Marketo nurture programs, gated assets, and email paths.