Skip to content

Instantly share code, notes, and snippets.

View siliconvallaeys's full-sized avatar

Frederick Vallaeys siliconvallaeys

View GitHub Profile
@siliconvallaeys
siliconvallaeys / PMax Search Terms and Categories in a Spreadsheet
Last active October 5, 2024 10:48
Add search terms and category labels from Performance Max campaigns on Google Ads to a Google spreadsheet automatically
function main() {
/******************************************
* PMax Search Terms Report
* @version: 1.0
* @authors: Frederick Vallaeys (Optmyzr)
* -------------------------------
* Install this script in your Google Ads account (not an MCC account)
* to generate a spreadsheet containing the search terms in your Performance Max campaigns.
* The spreadsheet also includes data about category labels (groupings of search terms).
* Metrics include conversion value, conversions, clicks, and impressions
@siliconvallaeys
siliconvallaeys / Blog Ideas from Trending Search Terms in Google Ads
Created October 2, 2024 17:55
Get blog topic ideas from your search terms data in Google Ads - uses GPT
@siliconvallaeys
siliconvallaeys / Identify positive keywords that conflict with negative typos
Created August 5, 2024 16:48
Google Ads negative keywords may also block searches for related search terms. This script helps identify scenarios where a negative keyword typo may interfere with a positive keyword.
function main() {
// Set up the output sheet
var outputSheet = setUpOutputSheet();
// Replace with the URL of your input Google Sheet
const SPREADSHEET_URL = ''; // Add the URL of the same Google Sheet as in the first script
const sheet = SpreadsheetApp.openByUrl(SPREADSHEET_URL).getActiveSheet();
// Fetch all keywords from active campaigns and store in a data structure
const keywordsMap = fetchAllKeywords();
@siliconvallaeys
siliconvallaeys / Google Ads Placement Exclusion by Unicode Script
Last active July 25, 2024 11:14
Add placement exclusions if a Google Ads placement name contains a character in a disallowed Unicode script
/*************************************************
* Placement Exclusion
* @version: 1.0
* @author: Naman Jindal (Optmyzr)
* -------------------------------
* Visit Optmyzr.com for PPC management tools and scripts
* including Rule-based automations, Reports, Audits, Team workflows,
* and optimization suggestions.
* -------------------------------
* Note Google limits placement (content) exclusions that may
@siliconvallaeys
siliconvallaeys / set tROAS by Min Temp
Last active May 30, 2024 05:20
Change a Google Ads tROAS for a campaign based on temperature
function main() {
var units = "metric"; // imperial or metric
var lat = "37.384998";
var lon = "-122.106689";
var openWeatherAPIKey = ""; // get your own key for the One Call API from https://openweathermap.org/api
var campaignName = 'Search: Executive Summary Report'; // put your campaign name here
var bidAdjustment = 1.5; // this is the scaling factor of the current tROAS
@siliconvallaeys
siliconvallaeys / Ad Text N-Grams
Last active May 20, 2024 21:55
Get an n-gram analysis of Google Ads ad texts
/**
*
* Ad Text N-Gram Mining Tool
*
* Get aggregated metrics for when the same word sequence is used in ads across your account.
* Discover better performing phrases from all your Google Ads.
*
* Based on a script by Daniel Gilbert and BrainLabsDigital.com (https://searchengineland.com/brainlabs-script-find-best-worst-search-queries-using-n-grams-228379)
*
* Adapted by Fred Vallaeys and Optmyzr.com to work with expanded ad text rather than search terms data
@siliconvallaeys
siliconvallaeys / GPT Suggestions for RSAs with Google Ads Scripts
Last active March 28, 2024 10:04
Generate a spreadsheet of ad text assets for a Google Ads accounts and use GPT to suggest new ad variations.
/******************************************
* RSA Report
* @version: 3.0
* @authors: Naman Jindal (Optmyzr), Frederick Vallaeys (Optmyzr)
* -------------------------------
* Install this script in your Google Ads account (not an MCC account)
* to generate a Google Sheet with a list of all your responsive search ads
* and their headlines and descriptions.
* For RSAs that are not using the maximum number of allowed variations,
* this script will suggest new variations for headlines and descriptions
@siliconvallaeys
siliconvallaeys / Check account is serving ads.js
Last active June 29, 2023 06:58
Check Account Is Serving Ads
/*
OPTMYZR.COM - PPC AUTOMATION AND TOOLS
---------------------------------------
Script by Optmyzr Inc. 2016-2018
This script checks whether an AdWords account has gone offline, possibly due to a declined credit card.
It does this by checking if a selected metric (like impressions) has accrued some value over a chosen
number of hours. The user can choose the number of hours to look back so that they can account for
expected periods of non-activity (e.g. due to dayparting)
@siliconvallaeys
siliconvallaeys / Google Ads summarizer with GPT
Last active June 27, 2023 15:08
Get a written performance summary of a Google Ads account's campaigns using GPT
/******************************************
* RSA Report
* @version: 1.0
* @authors: Frederick Vallaeys (Optmyzr), GPT-4 (openAI)
* -------------------------------
* Install this script in your Google Ads account (not an MCC account)
* to generate a textual summary of campaign performance.
* The text is generated using GPT and uses data from the Google Ads
* account in which this script is installed
* --------------------------------
@siliconvallaeys
siliconvallaeys / GPT Connector for Google Ads scripts
Created May 30, 2023 21:28
Use the openAI API in Google Ads scripts
/******************************************
* GPT Connector for Google Ads
* @version: 1.0
* @authors: Naman Jindal (Optmyzr), Frederick Vallaeys (Optmyzr)
* -------------------------------
* This function can be used to make a call to openAI's GPT in a Google Ads script.
* Use it to send prompts to GPT that include context about a Google Ads account.
* For example, you can send campaign data from Google Ads as part of a prompt that
* generates a text string with a summary of the account changes and performance.
* --------------------------------