PMAX Campaign Script for Better Visibility on Reporting.
PMAX Campaign Script, gives Insights on Spreadsheet which is a powerful tool to gain valuable campaign insights and optimize performance. Whether using a regular Google Ads script or a script within a My Client Center (MCC), the outcome remains consistent: the generation of the Insights Spreadsheet tailored to each account’s data.
PMAX Campaign Script
Spreadsheet is designed to deliver three key insights:
-
- Ad Placement Breakdown: Understand where your ads are being displayed – whether it’s on Shopping, Display, Video, or Search/Other networks. This breakdown allows you to assess the effectiveness of your ad placements across different Google networks.
-
- Search Category Analysis: Gain insights into the search categories triggering your ads. This is akin to understanding the types of search queries that lead to ad impressions, helping refine keyword targeting and optimize campaign relevance.
-
- Product Performance Matrix: Utilizing a sophisticated product matrix, all products are categorized into six distinct performance buckets. This classification is based on product titles and IDs, providing actionable data to optimize product campaigns.
Spend Allocation Insights: At the account level, you’ll receive comprehensive metrics for each channel (Shopping, Display, Video, Search/Other), accompanied by visualizations and a consolidated table showcasing campaign metrics across all channels. This enables strategic allocation of ad spend based on channel performance.
Campaign-Level Analysis: For individual campaigns, delve deeper into channel performance over time by specifying custom date ranges. Additionally, explore search category insights specific to each campaign, along with detailed metrics for each category, facilitating precise campaign optimization.
Search Categories Classification: By entering brand terms, search categories are categorized into four buckets:
-
- Blank: Categories not associated with brand terms.
-
- Brand: Exact matches to specified brand terms.
-
- Close-Brand: Related to brand terms but not exact matches.
-
- Non-Brand: Categories distinct from specified brand terms.
This categorization includes calculations for Average Order Value (AOV), Click-Through Rate (CTR), and Conversion Rate (CvR) for each bucket, supported by visual representations to assess campaign performance based on category relevance.
Product Performance Matrix: The product matrix categorizes products into six performance-based buckets, offering detailed metrics and classifications for Shopping campaigns. Additionally, a supplemental feed listing product IDs with their corresponding buckets is provided, facilitating seamless integration with Google Merchant Center (GMC) for targeted product optimization.
This comprehensive Insights Spreadsheet equips advertisers with actionable data to refine targeting strategies, optimize ad placements, and enhance product campaign performance. By leveraging these insights, advertisers can make informed decisions to maximize the effectiveness of Google Ads campaigns and drive tangible business results.
Copy the Below Script
// To Learn about Google Ads Script visit our Website https://trainmehub.com
// or Want to know about Google Marketing Platform and how to Automate it https://tinyurl.com/yc87sdmw
// it does everything the free script does, plus much more
// and includes free updates, support, some training & more
// make a copy of this template sheet first & copy your URL into the ss variable on line 11. template: https://docs.google.com/spreadsheets/d/1qXFNS0-8jtRxAbtk_-xH-CeS1p87H5hZL7I1QEe5Y1U/copy
function main() {
let ss = SpreadsheetApp.openByUrl(‘ Paste the New URL that you have got by copying the above Template ‘);
let zombieDays = 366 // how many days data do you want to use to identify zombie (0 click) products?
let prodDays = 181 // how many days data do you want to use to identify ‘long range’ products?
// don’t change any code below this line ———————————
// define query elements. wrap with spaces for safety
let impr = ‘ metrics.impressions ‘;
let clicks = ‘ metrics.clicks ‘;
let cost = ‘ metrics.cost_micros ‘;
let conv = ‘ metrics.conversions ‘;
let value = ‘ metrics.conversions_value ‘;
let allConv = ‘ metrics.all_conversions ‘;
let allValue = ‘ metrics.all_conversions_value ‘;
let views = ‘ metrics.video_views ‘;
let cpv = ‘ metrics.average_cpv ‘;
let segDate = ‘ segments.date ‘;
let prodTitle = ‘ segments.product_title ‘;
let prodID = ‘ segments.product_item_id ‘;
let prodC0 = ‘ segments.product_custom_attribute0 ‘;
let prodC1 = ‘ segments.product_custom_attribute1 ‘;
let prodC2 = ‘ segments.product_custom_attribute2 ‘;
let prodC3 = ‘ segments.product_custom_attribute3 ‘;
let prodC4 = ‘ segments.product_custom_attribute4 ‘;
let campName = ‘ campaign.name ‘;
let chType = ‘ campaign.advertising_channel_type ‘;
let adgName = ‘ ad_group.name ‘;
let adStatus = ‘ ad_group_ad.status ‘;
let adPerf = ‘ ad_group_ad_asset_view.performance_label ‘;
let adType = ‘ ad_group_ad_asset_view.field_type ‘;
let aIdAsset = ‘ asset.resource_name ‘;
let aId = ‘ asset.id ‘;
let assetType = ‘ asset.type ‘;
let aFinalUrl = ‘ asset.final_urls ‘;
let assetName = ‘ asset.name ‘;
let assetText = ‘ asset.text_asset.text ‘;
let assetSource = ‘ asset.source ‘ ;
let adUrl = ‘ asset.image_asset.full_size.url ‘;
let ytTitle = ‘ asset.youtube_video_asset.youtube_video_title ‘;
let ytId = ‘ asset.youtube_video_asset.youtube_video_id ‘;
let agId = ‘ asset_group.id ‘;
let assetFtype = ‘ asset_group_asset.field_type ‘;
let adPmaxPerf = ‘ asset_group_asset.performance_label ‘;
let agStrength = ‘ asset_group.ad_strength ‘;
let agStatus = ‘ asset_group.status ‘;
let asgName = ‘ asset_group.name ‘;
let lgType = ‘ asset_group_listing_group_filter.type ‘;
let aIdCamp = ‘ segments.asset_interaction_target.asset ‘;
let interAsset = ‘ segments.asset_interaction_target.interaction_on_this_asset ‘;
let pMaxOnly = ‘ AND campaign.advertising_channel_type = “PERFORMANCE_MAX” ‘;
let searchOnly = ‘ AND campaign.advertising_channel_type = “SEARCH” ‘;
let agFilter = ‘ AND asset_group_listing_group_filter.type != “SUBDIVISION” ‘;
let adgEnabled = ‘ AND ad_group.status = “ENABLED” AND campaign.status = “ENABLED” AND ad_group_ad.status = “ENABLED” ‘;
let asgEnabled = ‘ asset_group.status = “ENABLED” AND campaign.status = “ENABLED” ‘;
let notInter = ‘ AND segments.asset_interaction_target.interaction_on_this_asset != “TRUE” ‘;
let inter = ‘ AND segments.asset_interaction_target.interaction_on_this_asset = “TRUE” ‘;
let date07 = ‘ segments.date DURING LAST_7_DAYS ‘;
let date30 = ‘ segments.date DURING LAST_30_DAYS ‘;
let order = ‘ ORDER BY campaign.name ‘;
let orderImpr = ‘ ORDER BY metrics.impressions DESC ‘;
// Date stuff
let MILLIS_PER_DAY = 1000 * 60 * 60 * 24;
let now = new Date();
let from = new Date(now.getTime() – zombieDays * MILLIS_PER_DAY); // xx days in the past – default 366
let prod180 = new Date(now.getTime() – prodDays * MILLIS_PER_DAY); // xx days in the past – default 181
let to = new Date(now.getTime() – 1 * MILLIS_PER_DAY); // yesterday
let timeZone = AdsApp.currentAccount().getTimeZone();
let zombieRange = ‘ segments.date BETWEEN “‘ + Utilities.formatDate(from, timeZone, ‘yyyy-MM-dd’) + ‘” AND “‘ + Utilities.formatDate(to, timeZone, ‘yyyy-MM-dd’) + ‘”‘
let prodDate = ‘ segments.date BETWEEN “‘ + Utilities.formatDate(prod180, timeZone, ‘yyyy-MM-dd’) + ‘” AND “‘ + Utilities.formatDate(to, timeZone, ‘yyyy-MM-dd’) + ‘”‘
// build queries
let cd = [segDate, campName, cost, conv, value, views, cpv, impr, clicks, chType] // campaign by day
let campQuery = ‘SELECT ‘ + cd.join(‘,’) +
‘ FROM campaign ‘ +
‘ WHERE ‘ + date30 + pMaxOnly + order ;
let dv = [segDate, campName, aIdCamp, cost, conv, value, views, cpv, impr, chType, interAsset] // inter by day
let dvQuery = ‘SELECT ‘ + dv.join(‘,’) +
‘ FROM campaign ‘ +
‘ WHERE ‘ + date30 + pMaxOnly + notInter + order ;
let p = [campName, prodTitle, cost, conv, value, impr, chType,prodID,prodC0,prodC1,prodC2,prodC3,prodC4] // product totals
let pQuery = ‘SELECT ‘ + p.join(‘,’) +
‘ FROM shopping_performance_view ‘ +
‘ WHERE ‘ + date30 + pMaxOnly + order ;
let p180Query = ‘SELECT ‘ + p.join(‘,’) +
‘ FROM shopping_performance_view ‘ +
‘ WHERE ‘ + prodDate + pMaxOnly + order ;
let ag = [segDate, campName, asgName, agStrength, agStatus, lgType, impr, clicks, cost, conv, value] // asset group by day
let agQuery = ‘SELECT ‘ + ag.join(‘,’) +
‘ FROM asset_group_product_group_view ‘ +
‘ WHERE ‘ + date30 + agFilter ;
let assets = [aId, aFinalUrl, assetSource, assetType, ytTitle, ytId, assetText, aIdAsset, assetName] // names, IDs, URLs for all ad assets in account
let assetQuery = ‘SELECT ‘ + assets.join(‘,’) +
‘ FROM asset ‘ ;
let ads = [campName, asgName, agId, aIdAsset, assetFtype, adPmaxPerf, agStrength, agStatus, assetSource] // pMax ads
let adsQuery = ‘SELECT ‘ + ads.join(‘,’) +
‘ FROM asset_group_asset ‘ ;
let zombies = [prodID, clicks, impr, prodTitle] // zombie (0click) products – last xx days, set xx days at top of script
let zQuery = ‘SELECT ‘ + zombies.join(‘,’) +
‘ FROM shopping_performance_view ‘ +
‘ WHERE metrics.clicks < 1 AND ‘ + zombieRange + orderImpr ;
// call report function to pull data & push it to the named tabs in the sheet
runReport(campQuery, ss.getSheetByName(‘r_camp’));
runReport(dvQuery, ss.getSheetByName(‘r_dv’));
runReport(pQuery, ss.getSheetByName(‘r_prod_t’));
runReport(p180Query, ss.getSheetByName(‘r_prod_t_180’));
runReport(agQuery, ss.getSheetByName(‘r_ag’));
runReport(assetQuery, ss.getSheetByName(‘r_allads’));
runReport(adsQuery, ss.getSheetByName(‘r_ads’));
runReport(zQuery, ss.getSheetByName(‘zombies’));
} // end main
For More Information call us at +91- 9910656940, 9736790007
-
apus wordpress
0 Courses
0 Students -
ganeshatrainmehub
2 Courses
0 Students -
Karan Rajput
0 Courses
0 Students -
Ullekh Tandon
4 Courses
0 Students -
Vishakha Singh
0 Courses
0 Students