Traffic Source

A vs B has no single condition type called "Traffic Source" that automatically sorts visitors into organic, paid, social, direct, and referral. You build that targeting yourself, with two general-purpose conditions in the Audience Builder. Use Query Parameters for anything tagged with a UTM parameter, and Custom Javascript for anything you can only tell from the referring page. This page shows you how to use each one.

Targeting a traffic channel by its UTM tag: here, visitors arriving with utm_source=google.

Targeting by campaign parameters (UTM)

Most paid, email, and affiliate campaigns tag their links with UTM query parameters, such as ?utm_source=google&utm_medium=cpc. Match on these with a Query Parameters condition:

  1. In the Audience Builder, add a condition of type Query Parameters.
  2. Set the operator to equals (or contains, if the value can vary).
  3. Enter the parameter key, such as utm_source, and the value to match, such as google.

A single Query Parameters condition checks one key and one value. To match several values, for example any of your paid channels, add one condition per value and combine them with OR:

Plain text
Query Parameters equals utm_medium=cpc    ORQuery Parameters equals utm_medium=ppc    ORQuery Parameters equals utm_medium=paid
Plain text3 lines

You can match any UTM key this way, not just utm_source and utm_medium: utm_campaign, utm_content, and utm_term work the same way, one Query Parameters condition per key and value.

No automatic Organic, Paid, or Social labels

A vs B does not read the referring domain and label a visitor "organic" or "social" for you. If you want that distinction, you have two options. Tag your own campaign links with UTM parameters and match on those, or read the referrer yourself with a Custom Javascript condition, covered next.

Targeting by referrer

Some visitors arrive with no UTM parameter at all. For example, someone who clicked an organic (unpaid) result on Google, or a post on a social network. The only way to target these is a Custom Javascript condition, which runs a short piece of JavaScript on the page and matches when that code returns true.

Social referrers

If a social campaign already tags its links with utm_medium=social, a Query Parameters condition is simpler and catches paid social too. Use Custom Javascript for the traffic that arrives without any tag:

Plain text
return document.referrer.includes('facebook.com')  || document.referrer.includes('twitter.com')  || document.referrer.includes('instagram.com')  || document.referrer.includes('linkedin.com')  || document.referrer.includes('pinterest.com')
Plain text5 lines

Search-engine referrers (organic)

Plain text
return document.referrer.includes('google.')  || document.referrer.includes('bing.com')  || document.referrer.includes('duckduckgo.com')
Plain text3 lines

Direct traffic

Plain text
return document.referrer === ''
Plain text1 line

A visitor who typed your URL, used a bookmark, or opened your site from an app that strips the referrer header has an empty document.referrer. This condition catches all three.

Referral (everything else)

A Custom Javascript condition only has one operator, returns true, with no built-in "does not match" toggle. So write the exclusion straight into the JavaScript:

Plain text
return document.referrer !== ''  && !document.referrer.includes('google.')  && !document.referrer.includes('bing.com')  && !document.referrer.includes('facebook.com')
Plain text4 lines
Already have a channel cookie?

A Cookie condition is simpler than parsing the referrer yourself, if your marketing tool already writes the visitor's channel into a cookie. For example: Cookie channel equals paid-search.

Common use cases

Different experiences for paid vs organic

Visitors who arrive from paid ads often have different expectations than organic visitors: they clicked a specific ad with a specific promise. Use a Query Parameters condition on utm_medium to build a paid-only audience, and test messaging suited to people who just saw your ad.

Landing page optimization by channel

If a paid campaign drives traffic to a landing page, target that traffic with a Query Parameters condition matching your campaign's UTM tag. Then test headlines and CTAs for it. Organic visitors who land on the same page are not enrolled, so they always see the control until you are confident in your results.

Social campaign experiments

Running a social media campaign? Use a Custom Javascript condition to catch visitors referred from the social platform. Then test whether a social-proof-heavy hero section converts better than a features-focused one for that audience.

Tip

Combine a Query Parameters (or Custom Javascript) condition with New/Returning Session for a sharper segment. "New visitors from paid traffic" are people who have never been to your site before and arrived through an ad. This is often the audience most influenced by a top-of-funnel experiment.

Was this helpful?