whenever i try it shows the same error Problem with the spreadsheet URL: 'Exception: Unexpected error while getting the method or property openByUrl on object SpreadsheetApp.'
can you also make a video about this ngram to analyze ad text? That script which is available is somehow broken it doesn`t work. Can you contact that guy who made that script and tell him it doesn`t work in ads account anymore :D , probably just needs another update. it returns blank columns for phrases.
I didn't write the original script, but to fix the script for the error "Cannot read properties of undefined (reading 'id') at main (Code:236:59) at Object.(adsapp_compiled:20552:54)": // Around line 236, the error occurs in the shared set data processing section // The issue is that sharedSetRow.sharedSet.id is undefined // Let's modify the GAQL query and data handling: // Original problematic section: var GAQLquery = "SELECT shared_set.id, shared_criterion.keyword.match_type, shared_criterion.keyword.text FROM shared_criterion"; var sharedSetRows = AdsApp.search(GAQLquery); while (sharedSetRows.hasNext()) { var sharedSetRow = sharedSetRows.next(); var setName = sharedSetNames[sharedSetRow.sharedSet.id]; // Error occurs here // ... rest of the code } // Fixed version: // First, let's modify the GAQL query to ensure we get all necessary fields var GAQLquery = ` SELECT shared_set.id, shared_set.name, shared_criterion.keyword.match_type, shared_criterion.keyword.text FROM shared_criterion WHERE shared_set.status = 'ENABLED' `; var sharedSetRows = AdsApp.search(GAQLquery); while (sharedSetRows.hasNext()) { var sharedSetRow = sharedSetRows.next();
// Add defensive checks if (!sharedSetRow.sharedSet || !sharedSetRow.sharedSet.id) { Logger.log("Skipping row - missing shared set data"); continue; }
var setName = sharedSetNames[sharedSetRow.sharedSet.id];
// Only process if we have a valid setName and campaign mappings if (setName && sharedSetCampaigns[setName]) { for (var i = 0; i < sharedSetCampaigns[setName].length; i++) { var campaignId = sharedSetCampaigns[setName][i];
// Ensure we have valid keyword data if (sharedSetRow.sharedCriterion && sharedSetRow.sharedCriterion.keyword && sharedSetRow.sharedCriterion.keyword.text) {
if (negativesByCampaign[campaignId] == undefined) { negativesByCampaign[campaignId] = [ [sharedSetRow.sharedCriterion.keyword.text.toLowerCase(), sharedSetRow.sharedCriterion.keyword.matchType.toLowerCase()] ]; } else { negativesByCampaign[campaignId].push( [sharedSetRow.sharedCriterion.keyword.text.toLowerCase(), sharedSetRow.sharedCriterion.keyword.matchType.toLowerCase()] ); } } } } } // The rest of your script remains the same...
Than you! Super useful, im excited to try this in my accounts. Please post more videos on other helpful scripts!
Great script! Loving this technical content to get more account insights. Thanks for sharing!
whenever i try it shows the same error
Problem with the spreadsheet URL: 'Exception: Unexpected error while getting the method or property openByUrl on object SpreadsheetApp.'
This is crazyyy
You guys are pros
Great content!
can you also make a video about this ngram to analyze ad text? That script which is available is somehow broken it doesn`t work. Can you contact that guy who made that script and tell him it doesn`t work in ads account anymore :D , probably just needs another update. it returns blank columns for phrases.
I didn't write the original script, but to fix the script for the error "Cannot read properties of undefined (reading 'id') at main (Code:236:59) at Object.(adsapp_compiled:20552:54)":
// Around line 236, the error occurs in the shared set data processing section
// The issue is that sharedSetRow.sharedSet.id is undefined
// Let's modify the GAQL query and data handling:
// Original problematic section:
var GAQLquery = "SELECT shared_set.id, shared_criterion.keyword.match_type, shared_criterion.keyword.text FROM shared_criterion";
var sharedSetRows = AdsApp.search(GAQLquery);
while (sharedSetRows.hasNext()) {
var sharedSetRow = sharedSetRows.next();
var setName = sharedSetNames[sharedSetRow.sharedSet.id]; // Error occurs here
// ... rest of the code
}
// Fixed version:
// First, let's modify the GAQL query to ensure we get all necessary fields
var GAQLquery = `
SELECT
shared_set.id,
shared_set.name,
shared_criterion.keyword.match_type,
shared_criterion.keyword.text
FROM shared_criterion
WHERE shared_set.status = 'ENABLED'
`;
var sharedSetRows = AdsApp.search(GAQLquery);
while (sharedSetRows.hasNext()) {
var sharedSetRow = sharedSetRows.next();
// Add defensive checks
if (!sharedSetRow.sharedSet || !sharedSetRow.sharedSet.id) {
Logger.log("Skipping row - missing shared set data");
continue;
}
var setName = sharedSetNames[sharedSetRow.sharedSet.id];
// Only process if we have a valid setName and campaign mappings
if (setName && sharedSetCampaigns[setName]) {
for (var i = 0; i < sharedSetCampaigns[setName].length; i++) {
var campaignId = sharedSetCampaigns[setName][i];
// Ensure we have valid keyword data
if (sharedSetRow.sharedCriterion &&
sharedSetRow.sharedCriterion.keyword &&
sharedSetRow.sharedCriterion.keyword.text) {
if (negativesByCampaign[campaignId] == undefined) {
negativesByCampaign[campaignId] = [
[sharedSetRow.sharedCriterion.keyword.text.toLowerCase(),
sharedSetRow.sharedCriterion.keyword.matchType.toLowerCase()]
];
} else {
negativesByCampaign[campaignId].push(
[sharedSetRow.sharedCriterion.keyword.text.toLowerCase(),
sharedSetRow.sharedCriterion.keyword.matchType.toLowerCase()]
);
}
}
}
}
}
// The rest of your script remains the same...
Fantastic content .. is there any course you guys provide for this ?