Skip to content

get_language

Identifies the language code from a campaign name. This is used to segment performance reporting by the language of the ad creative.

Signature

sql
get_language(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 ISO-style language codes:

ValueLanguage
ENEnglish
DEGerman
FRFrench
ESSpanish
PTPortuguese
ITItalian
JAJapanese
KOKorean
ZHChinese
UnknownDefault when no language code is detected

Platform-Specific Behavior

The language code sits at different positions within each platform's naming convention. Most platforms place it as the 5th pipe-delimited segment, but StackAdapt uses a different structure that requires special position handling.

PlatformParsing Notes
Google / MicrosoftTypically the 5th pipe-delimited segment
LinkedInLinkedIn-specific naming position
RedditReddit-specific naming position
6senseUnderscore-delimited naming position
StackAdaptSpecial position handling -- language may appear in a non-standard location

Example

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

Sample output:

CampaignNameLanguageTotalImpressions
SUSE | SRCH | NA | T1 | EN | Linux | SLESEN125000
SUSE | SRCH | EMEA | T1 | DE | Linux | SLESDE43000
SUSE | DISP | EMEA | T1 | FR | Cloud Native | RancherFR31000
SUSE | PSOC | APAC | T1 | JA | AI | MLSJA18000

Multi-Language Performance Analysis

sql
-- Compare CTR across languages for a specific product
SELECT
  customer_ads_suse.get_language(CampaignName, 'google') AS Language,
  customer_ads_suse.get_product(CampaignName, 'google') AS Product,
  SUM(Impressions) AS TotalImpressions,
  SUM(Clicks) AS TotalClicks,
  SAFE_DIVIDE(SUM(Clicks), SUM(Impressions)) AS CTR
FROM `paidteam-data-warehouse.customer_ads_suse.suse_google_adlevel_final_v2`
WHERE Date >= '2026-01-01'
GROUP BY Language, Product
HAVING TotalImpressions > 1000
ORDER BY Product, CTR DESC;

StackAdapt Note

StackAdapt campaigns may encode the language in a non-standard position compared to other platforms. The function handles this automatically when 'stackadapt' is passed as the platform parameter, but be aware that StackAdapt campaign names may look structurally different from campaigns on other platforms.

SUSE Paid Advertising Data Warehouse V2