Appearance
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 STRINGParameters
| Parameter | Type | Description |
|---|---|---|
campaign | STRING | The 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:
| Value | Description |
|---|---|
Prospecting | Targeting new audiences who have not previously engaged |
Retargeting | Targeting users who have previously visited or engaged |
TOFU | Top of Funnel -- awareness-stage targeting |
MOFU | Middle of Funnel -- consideration-stage targeting |
BOFU | Bottom of Funnel -- decision-stage targeting |
Geofencing | Location-based targeting around specific geographic areas |
Unknown | Default 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:
| CampaignName | Audience |
|---|---|
| SUSE | PSOC | NA | T1 | EN | Cloud Native | Rancher | Prospecting | Prospecting |
| SUSE | PSOC | EMEA | T1 | EN | Linux | SLES | Retargeting | Retargeting |
| SUSE | PSOC | APAC | T1 | EN | AI | MLS | TOFU | TOFU |
| SUSE | PSOC | NA | T1 | EN | Edge | Edge | Prospecting + Retargeting | Prospecting + Retargeting |
| SUSE | PSOC | EMEA | T1 | EN | All | General | BOFU | BOFU |
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.