Extract Data from Campaign Name

Extract information from the campaign name and use it to set the value of a Dimension in Marin.

What can I do with this?

  • Automatically set Dimension values based on the campaign name
  • Create roll-up across account structures with Dimensions
  • Use cases include:
    • Brand vs Non-brand
    • Geo
    • Audience
    • Funnel Stage or Intent
    • Optimization Targets

Example

Campaigns Grid

Data Rolled up by Brand/Non-brand Dimensions

How it works

Extracts text from the campaign name and uses the provided rules to parse the desired information. There are three general approaches for different campaign naming conventions:

  • String Matching: Looks for a string in the name, and sets a value if found
  • Structured: Parses the campaign name based on a separator and extracts information from each different positions 
  • Custom: Regular expressions (regex) can be used for more complex structures

Requirements

Setup

  • At least one Dimension to hold the extracted value

Report

  • Account
  • Campaign name

Script

Simple String Matching example

Sample Logic

  • If Campaign contains “Brand” → “Brand”
  • If Campaign doesn't contain “Brand” → “Non-brand”

Sample Output

Campaign Name (Input) Dimension Value (Output)
US - Brand Brand
UK - Competitor Non-brand
Facebook Retargeting Non-brand

 

 

String Matching with Logic

Sample Logic

  • If Campaign name contains (US or CA) → NA
  • If Campaign name contains (UK or FR) → EMEA

Sample Output

Campaign Name (Input) Dimension Value (Output)
US - Brand NA
UK - Competitor EMEA
Facebook Retargeting  
CA - Social NA
FR - Tiktok EMEA

Structured Name with Separator

Sample Logic

  • Separator: -
  • Position: 1

Sample Output

Campaign Name (Input)

Dimension Value (Output)

US - Brand

US

UK - Competitor

UK

Facebook Retargeting

 

CA - Social

CA

FR - Tiktok

FR

Custom Extract with Regex

Sample Logic

  • Extract everything after the “-” in the campaign name
  • Regex:  -(.*)

Sample Output

Campaign Name (Input) Dimension Value (Output
US - Brand Brand
UK - Competitor Competitor
Facebook Retargeting  
CA - Social Social
FR - Tiktok Tiktok

 

 

Written by Wes MacLaggan

Last published at: March 19th, 2024