Skip to content

get_subproduct

Extracts a free-text sub-product identifier from the campaign name. This provides a more granular product classification beneath the main product level.

Signature

sql
get_subproduct(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 containing the sub-product name. Unlike other UDFs that return from a fixed set of values, this function returns free-text extracted from the campaign name. Common examples include specific solution names, use cases, or campaign themes.

Returns "None" if no sub-product is found in the campaign name.

How It Works

The sub-product is typically an optional field in the campaign naming convention, placed after the main product. Not all campaigns include a sub-product, so this field frequently returns "None".

The function is platform-aware because the sub-product sits at different positions within each platform's naming convention.

Example

sql
SELECT
  CampaignName,
  customer_ads_suse.get_product(CampaignName, 'google') AS Product,
  customer_ads_suse.get_subproduct(CampaignName, 'google') AS SubProduct
FROM `paidteam-data-warehouse.customer_ads_suse.suse_google_adlevel_final_v2`
WHERE Date = '2026-02-01'
LIMIT 5;

Sample output:

CampaignNameProductSubProduct
SUSE | SRCH | NA | T1 | EN | Linux | SLES | BrandSLESBrand
SUSE | SRCH | NA | T1 | EN | Linux | SLES | MigrationSLESMigration
SUSE | DISP | EMEA | T1 | EN | Cloud Native | RancherRancherNone
SUSE | PSOC | APAC | T1 | EN | AI | MLS | GenAIMLSGenAI
SUSE | SRCH | NA | T1 | EN | All | GeneralAllNone

Filtering by Sub-Product

sql
-- Find all campaigns with a specific sub-product
SELECT
  CampaignName,
  customer_ads_suse.get_subproduct(CampaignName, 'microsoft') AS SubProduct,
  SUM(Impressions) AS TotalImpressions,
  SUM(Clicks) AS TotalClicks
FROM `paidteam-data-warehouse.customer_ads_suse.suse_microsoft_adlevel_final_v2`
WHERE Date >= '2026-01-01'
GROUP BY CampaignName, SubProduct
HAVING SubProduct != 'None'
ORDER BY TotalImpressions DESC;

Product Hierarchy

The sub-product is the third level in the product hierarchy:

  1. Product Line -- get_product_line() (e.g., Linux, Cloud Native, AI)
  2. Product -- get_product() (e.g., SLES, Rancher, MLS)
  3. Sub-Product -- get_subproduct() (e.g., Brand, Migration, GenAI)

SUSE Paid Advertising Data Warehouse V2