Appearance
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 STRINGParameters
| Parameter | Type | Description |
|---|---|---|
campaign | STRING | The full campaign name string |
platform | STRING | The advertising platform (google, microsoft, linkedin, reddit, 6sense, stackadapt) |
Return Value
Returns a STRING with one of the following ISO-style language codes:
| Value | Language |
|---|---|
EN | English |
DE | German |
FR | French |
ES | Spanish |
PT | Portuguese |
IT | Italian |
JA | Japanese |
KO | Korean |
ZH | Chinese |
Unknown | Default 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.
| Platform | Parsing Notes |
|---|---|
| Google / Microsoft | Typically the 5th pipe-delimited segment |
| LinkedIn-specific naming position | |
| Reddit-specific naming position | |
| 6sense | Underscore-delimited naming position |
| StackAdapt | Special 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:
| CampaignName | Language | TotalImpressions |
|---|---|---|
| SUSE | SRCH | NA | T1 | EN | Linux | SLES | EN | 125000 |
| SUSE | SRCH | EMEA | T1 | DE | Linux | SLES | DE | 43000 |
| SUSE | DISP | EMEA | T1 | FR | Cloud Native | Rancher | FR | 31000 |
| SUSE | PSOC | APAC | T1 | JA | AI | MLS | JA | 18000 |
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.