Skip to content

get_content_name

Extracts a human-readable content name from creative naming patterns. This function is used in creative performance views to provide friendly labels for ad creatives.

Current Version: 1.2.0

Signature

sql
get_content_name(creative_name STRING, campaign_name STRING) RETURNS STRING

Parameters

ParameterTypeDescription
creative_nameSTRINGThe ad creative or ad name string
campaign_nameSTRINGThe campaign name string (used for Thought Leadership detection)

Return Value

Returns a STRING containing the human-readable content name, normalized to lowercase with underscores replaced by spaces. Returns the original creative_name if no pattern matches.

Pattern Matching

The function attempts to match the creative name against five patterns in order. The first pattern that matches is used.

Pattern A: Full Pipe-Delimited

Format: {code} | {content_name} | {dimensions} | {version}

0005547 | gartner_webinar | 1200x628 | v2

Result: gartner webinar

The function extracts the second pipe-delimited segment, trims whitespace, and replaces underscores with spaces.

Pattern B: Code-Prefixed Underscore with Dimensions

Format: {code} | {content_description}_{dimensions}_{version}

0013663 | Thought_Leadership_Webinar_Modernize_1200x1200_V1

Result: thought leadership webinar modernize

The function extracts text after the first pipe, then strips the trailing dimension and version segments.

Pattern C: Code-Prefixed Pipe without Dimensions

Format: {code} | {content_name} | {version}

0012312 | How_to_Operationalize_AI | v1

Result: how to operationalize ai

The function extracts the second pipe-delimited segment when only three segments exist.

Pattern D: Code-Prefixed Underscore (No Pipe)

Format: {code}_{content_name}_{dimensions}_{version}

0013136_Defining the telco cloud_1200x1200_V1

Result: defining the telco cloud

The function extracts text between the first underscore and the dimension/version suffix.

Pattern E: Single Pipe Fallback

Format: {anything} | {content_name}

If the creative name contains a single pipe, the function takes the text after the pipe as the content name.

Special Case: Thought Leadership

When the campaign_name contains "Thought Leadership" (case-insensitive) and the creative_name is NULL or empty, the function returns:

sponsored thought leadership post

This handles LinkedIn Thought Leadership ads where the creative name is not populated by the platform.

Examples

sql
-- Basic usage
SELECT
  AdName,
  customer_ads_suse.get_content_name(AdName, CampaignName) AS ContentName
FROM `paidteam-data-warehouse.customer_ads_suse.suse_linkedin_adlevel_final_v2`
WHERE Date = '2026-02-01'
LIMIT 10;

Sample output:

AdNameContentName
0005547 | gartner_webinar | 1200x628 | v2gartner webinar
0013663 | Thought_Leadership_Webinar_Modernize_1200x1200_V1thought leadership webinar modernize
0012312 | How_to_Operationalize_AI | v1how to operationalize ai
0013136_Defining the telco cloud_1200x1200_V1defining the telco cloud
(empty)sponsored thought leadership post

Usage in Creative Performance Views

sql
-- Content name is typically used in creative performance views
SELECT
  customer_ads_suse.get_content_name(c.CreativeName, a.CampaignName) AS ContentName,
  customer_ads_suse.get_campaign_code(a.CampaignName, a.AdName, 'linkedin') AS CampaignCode,
  SUM(a.Impressions) AS TotalImpressions,
  SUM(a.Clicks) AS TotalClicks
FROM `paidteam-data-warehouse.customer_ads_suse.suse_linkedin_adlevel_final_v2` a
LEFT JOIN `paidteam-data-warehouse.customer_ads_suse.suse_linkedin_creative_final_v2` c
  ON a.CreativeID = c.CreativeID
WHERE a.Date >= '2026-01-01'
GROUP BY ContentName, CampaignCode
ORDER BY TotalImpressions DESC;

Version History

VersionDateChanges
1.2.02026-02-08Added Thought Leadership special case handling
1.1.0--Added Pattern D support for underscore-only delimiters
1.0.0--Initial release with Patterns A, B, C, and E

SUSE Paid Advertising Data Warehouse V2