Skip to content

get_tier

Extracts the market tier designation from a campaign name. Tiers represent the priority or market classification of the targeted countries.

Signature

sql
get_tier(campaign STRING, platform STRING) RETURNS STRING

Parameters

ParameterTypeDescription
campaignSTRINGThe full campaign name string
platformSTRINGThe advertising platform (google, microsoft, linkedin, reddit, 6sense, stackadapt)

Return Value

Returns a STRING with one of the following tier values:

ValueDescription
T1Tier 1 -- highest priority markets
T2Tier 2 -- secondary markets
T1+2Combined Tier 1 and Tier 2 targeting
T1+2+3All tiers combined
Tier 1StackAdapt format (converted from Tier N to TN in some contexts)
Tier 2StackAdapt format
UnknownDefault when no tier is detected

Platform-Specific Behavior

Most platforms use the compact T1, T2 format in their campaign names. StackAdapt is the exception, using the longer Tier 1, Tier 2 format.

PlatformFormatExample
GoogleT1, T2, T1+2SUSE | SRCH | NA | T1 | EN | ...
MicrosoftT1, T2, T1+2SUSE | SRCH | EMEA | T2 | EN | ...
LinkedInT1, T2, T1+2SUSE | PSOC | NA | T1 | EN | ...
RedditT1, T2, T1+2Reddit-specific position
6senseT1, T2, T1+26sense-specific position
StackAdaptTier 1, Tier 2StackAdapt uses the longer format

Example

sql
SELECT
  CampaignName,
  customer_ads_suse.get_tier(CampaignName, 'google') AS Tier,
  SUM(Clicks) AS TotalClicks
FROM `paidteam-data-warehouse.customer_ads_suse.suse_google_adlevel_final_v2`
WHERE Date >= '2026-01-01'
GROUP BY CampaignName, Tier
ORDER BY TotalClicks DESC
LIMIT 10;

Sample output:

CampaignNameTierTotalClicks
SUSE | SRCH | NA | T1 | EN | Linux | SLEST14520
SUSE | DISP | EMEA | T1+2 | EN | Cloud Native | RancherT1+23100
SUSE | PSOC | APAC | T2 | EN | AI | MLST21890

Tier Distribution Analysis

sql
-- Analyze spend distribution across tiers
SELECT
  customer_ads_suse.get_tier(CampaignName, 'microsoft') AS Tier,
  COUNT(DISTINCT CampaignName) AS CampaignCount,
  SUM(Impressions) AS TotalImpressions,
  SUM(Clicks) AS TotalClicks,
  SUM(Cost) AS TotalCost
FROM `paidteam-data-warehouse.customer_ads_suse.suse_microsoft_adlevel_final_v2`
WHERE Date >= '2026-01-01'
GROUP BY Tier
ORDER BY TotalCost DESC;

SUSE Paid Advertising Data Warehouse V2