Skip to content

get_geo

Determines the geographic region targeted by a campaign. This function is platform-aware because different platforms encode geography at different positions in the campaign name.

Signature

sql
get_geo(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 geographic region values:

ValueDescription
NANorth America
EMEAEurope, Middle East, and Africa
APACAsia-Pacific
LATAMLatin America
EMEA APAC LATAMCombined international regions (excludes NA)
GlobalAll regions (default when no region is detected)

Platform-Specific Parsing

Each platform encodes the geographic region at a different position within the campaign name, so platform-specific regex patterns are applied.

PlatformParsing Notes
Google / MicrosoftTypically the 3rd pipe-delimited segment
LinkedInLinkedIn-specific naming position
RedditReddit-specific naming position
6senseUnderscore-delimited naming position
StackAdaptStackAdapt-specific naming position

Example

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

Sample output:

CampaignNameGeoTotalImpressions
SUSE | SRCH | NA | T1 | EN | Linux | SLESNA125000
SUSE | DISP | EMEA | T1 | EN | Cloud Native | RancherEMEA98000
SUSE | PSOC | APAC | T2 | EN | AI | MLSAPAC67000
SUSE | DISP | EMEA APAC LATAM | T1 | EN | AllEMEA APAC LATAM54000

Regional Performance Comparison

sql
-- Compare performance across regions
SELECT
  customer_ads_suse.get_geo(CampaignName, 'google') AS Geo,
  COUNT(DISTINCT CampaignName) AS Campaigns,
  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 Geo
ORDER BY TotalImpressions DESC;

SUSE Paid Advertising Data Warehouse V2