Skip to content

get_audience

Identifies the audience targeting type from a campaign name. This function can return multiple audience values when a campaign targets more than one audience segment.

Signature

sql
get_audience(campaign STRING) RETURNS STRING

Parameters

ParameterTypeDescription
campaignSTRINGThe full campaign name string

This function is not platform-aware -- audience keywords are consistent across all advertising platforms, so no platform parameter is needed.

Return Value

Returns a STRING with one or more of the following audience values, joined with " + " when multiple values are detected:

ValueDescription
ProspectingTargeting new audiences who have not previously engaged
RetargetingTargeting users who have previously visited or engaged
TOFUTop of Funnel -- awareness-stage targeting
MOFUMiddle of Funnel -- consideration-stage targeting
BOFUBottom of Funnel -- decision-stage targeting
GeofencingLocation-based targeting around specific geographic areas
UnknownDefault when no audience keyword is detected

Multi-Value Returns

When a campaign targets multiple audience segments, the function returns all matched values separated by " + ". For example:

  • "Prospecting + Retargeting" -- a campaign targeting both new and returning users
  • "TOFU + MOFU" -- a campaign spanning awareness and consideration stages
  • "Prospecting" -- a single audience type

Example

sql
SELECT
  CampaignName,
  customer_ads_suse.get_audience(CampaignName) AS Audience
FROM `paidteam-data-warehouse.customer_ads_suse.suse_linkedin_adlevel_final_v2`
WHERE Date = '2026-02-01'
LIMIT 5;

Sample output:

CampaignNameAudience
SUSE | PSOC | NA | T1 | EN | Cloud Native | Rancher | ProspectingProspecting
SUSE | PSOC | EMEA | T1 | EN | Linux | SLES | RetargetingRetargeting
SUSE | PSOC | APAC | T1 | EN | AI | MLS | TOFUTOFU
SUSE | PSOC | NA | T1 | EN | Edge | Edge | Prospecting + RetargetingProspecting + Retargeting
SUSE | PSOC | EMEA | T1 | EN | All | General | BOFUBOFU

Funnel Stage Analysis

sql
-- Analyze performance by funnel stage across all platforms
SELECT
  customer_ads_suse.get_audience(CampaignName) AS Audience,
  SUM(Impressions) AS TotalImpressions,
  SUM(Clicks) AS TotalClicks,
  SAFE_DIVIDE(SUM(Clicks), SUM(Impressions)) AS CTR,
  SUM(Cost) AS TotalCost,
  SAFE_DIVIDE(SUM(Cost), SUM(Clicks)) AS CPC
FROM `paidteam-data-warehouse.customer_ads_suse.suse_linkedin_adlevel_final_v2`
WHERE Date >= '2026-01-01'
GROUP BY Audience
ORDER BY TotalCost DESC;

Filtering by Audience Type

sql
-- Get all retargeting campaigns
SELECT *
FROM `paidteam-data-warehouse.customer_ads_suse.suse_google_adlevel_final_v2`
WHERE customer_ads_suse.get_audience(CampaignName) LIKE '%Retargeting%'
  AND Date >= '2026-01-01';

TIP

When filtering for audience types that may appear in multi-value results, use LIKE '%value%' rather than = 'value' to catch cases where the audience is combined with other types.

SUSE Paid Advertising Data Warehouse V2