Data source link: https://docs.google.com/spreadsheets/d/1E6p_e3YacgZlhpjYug01yHW9r_vaOdCx4TUQMwtKbMw/
Key Points:
- adding calculated fields,
- creating a custom dimension with conditional expressions (CASE + IN),
- using a regular expression (CASE + REGEXP_MATCH) to alter an existing dimension.
Call Girls In Mahipalpur O9654467111 Escorts Service
Google Data Studio_Calculated Fields and Custom Dimensions
1. Campaign Tactic Impressions Clicks CTR Media Spend Total Conversions CPA
Campaign 2 - FR Tactic 4 5.1M 7.7K 0.15% $22.9K 134 $170.62
Campaign 2 - EN Tactic 1 5.8M 8.9K 0.15% $24.2K 135 $179.61
Campaign 1 - EN Tactic 2 4.5M 7.5K 0.17% $15.0K 167 $89.86
Campaign 2 - FR Tactic 3 5.4M 9.4K 0.18% $24.0K 178 $134.57
Campaign 2 - EN Tactic 2 3.5M 6.7K 0.19% $17.6K 113 $155.4
Campaign 1 - EN Tactic 1 2.8M 8.2K 0.29% $16.6K 187 $88.83
Campaign 1 - FR Tactic 3 3.2M 9.6K 0.3% $21.1K 192 $109.78
Campaign 1 - FR Tactic 4 2.5M 8.7K 0.35% $20.5K 156 $131.1
Grand total 32.6M 66.7K 0.22% $161.8K 1,262 $132.47
▲
1 - 8 / 8 < >
English Campaign 2 - EN
Campaign 1 - EN
French Campaign 2 - FR
Campaign 1 - FR
Impressions Clicks Total Conversions Media Spend
9,277,257 15,625 248 $41,808
7,297,269 15,711 354 $31,617
10,460,126 17,115 312 $46,816
5,603,735 18,277 348 $41,529
Language Campaign
32,638,387 66,728 1,262 $161,770Grand total
Select date range ▼
Tactic ▼
Calculated Fields and Custom Dimensions
Adding Calculated Fields
Creating a Custom Dimension with Conditional Expressions (CASE + IN)
Using a Regular Expression (CASE + REGEXP_MATCH) to alter an existing dimension
CTR = Clicks / Impressions ( select AVG)
CPA = Media Spend / Total Conversion (select AVG)
Let's create a custom dimension (Language) so that, when we add it we could split those campaigns into English
and French:
CASE
WHEN Campaign IN ('Campaign 1 - EN', 'Campaign 2 - EN') THEN 'English'
WHEN Campaign IN ('Campaign 1 - FR', 'Campaign 2 - FR') THEN 'French'
ELSE 'Other Language'
END
REGEXP_MATCH function: returns true if X matches Y, false otherwise. Can only be used within the WHEN clause of CASE statements; not a standalone function.
X: A eld or expression (the dimension that you want to pull from.)
Reg Expr: A regular expression that you want to use.
Example: REGEXP_MATCH (name, '[a-zA-Z]*')
Let’s use a regular expression to capture a speci c position or a speci c word regardless of where that's happening within the string of text.
Example: Use REGEXP_MATCH function to capture the campaign name, even though that EN and FR move around the campaign naming. So there is a problem with the naming
convention of texturing.
Field Name = Language (Advanced) --> same for Type eld
CASE
WHEN REGEXP_MATCH (Complex Campaign, '.*(EN).*') THEN 'English'
WHEN REGEXP_MATCH (Complex Campaign, '.*(FR).*') THEN 'French'
ELSE 'Other Language'
END
(EN): We are putting brackets around English to specify that we want that speci c phrase 'English'.
'.*(EN).*': We use .* because we have the issue with where the EN is positioned. So it speci es if EN comes before or after any text.
English 2019_New Campaign_EN_Expanded_Brand
2019_New Campaign_EN_Brand
2019_New Campaign_Expanded_EN_Brand
2019_New Campaign_Brand_EN
EN
EN
EN
EN
French 2019_New Campaign_FR_Expanded_Brand
2019_New Campaign_Expanded_FR_Brand
2019_New Campaign_Brand_FR
2019_New Campaign_FR_Brand
FR
FR
FR
FR
Impressions Clicks Total Conversions Media Spend
5,826,978 8,925 135 $24,248
4,500,294 7,504 167 $15,006
3,450,279 6,700 113 $17,560
2,796,975 8,207 187 $16,611
5,360,017 9,449 178 $23,953
5,100,109 7,666 134 $22,863
3,153,701 9,582 192 $21,077
2,450,034 8,695 156 $20,452
Language (Advanced) Complex Campaign Type
If we remove the complex campaign, we just get English and French and the total amount of impressions, clicks, and total conversions for each.
English EN
French FR
Impressions Clicks Total Conversions Media Spend
16,574,526 31,336 602 $73,425
16,063,861 35,392 660 $88,345
Language (Advanced) Type
32,638,387 66,728 1,262 $161,770Grand total