Google Ads Scripts

Google Ads Scripts

Seed Keyword Combiner

This script combines seed keywords with modifiers to create a list of long-tail keywords.

function main() {
    var seedKeywords = [
        'golf packages',
        'golf vacations',
        'golf getaways',
        'golf holidays',
        'golf trips',
    ];
    var modifiers = [
        'luxury',
        'affordable',
        'all-inclusive',
        'discount',
        'last-minute',
        'weekend',
        'group',
        'best',
        'top',
        'family',
    ];
    var matchTypes = ['Phrase', 'Exact'];
    var combinedKeywords = generateKeywords(seedKeywords, modifiers, matchTypes);
    Logger.log(combinedKeywords);
}

function generateKeywords(seedKeywords, modifiers, matchTypes) {
    var combinedKeywords = [];
    for (var i = 0; i < seedKeywords.length; i++) {
        for (var j = 0; j < modifiers.length; j++) {
            for (var k = 0; k < matchTypes.length; k++) {
                combinedKeywords.push({
                    keyword: modifiers[j] + ' ' + seedKeywords[i],
                    matchType: matchTypes[k],
                });
            }
        }
    }
    return combinedKeywords;
}
        

Instructions:

Replace the placeholders in the script with your actual seed keywords and modifiers. After configuring the script, copy and paste it into the Google Ads script editor and run the script.

Ad Template Generator

Use this script to create ad templates that are customizable with dynamic elements such as golf package names, destinations, and prices. This script allows you to create multiple ads with minimal manual work.

function main() {
var SPREADSHEET_URL = 'YOUR_SPREADSHEET_URL';
var spreadsheet = SpreadsheetApp.openByUrl(SPREADSHEET_URL);
var sheet = spreadsheet.getSheetByName('Ad Templates');
var data = sheet.getDataRange().getValues();
  // Process header row
var headers = data.shift();

// Process each row
data.forEach(function (row) {
    var adTemplate = {};
    row.forEach(function (value, index) {
        adTemplate[headers[index]] = value;
    });

    // Create ad using the template
    createAd(adTemplate);
});
}

function createAd(adTemplate) {
// Replace this with your desired ad structure and placeholders
var headline1 = 'Discover {golfPackage} in {destination}';
var headline2 = 'Book Now and Save {discountPercentage}%';
var description = 'Experience {destination} with our exclusive {golfPackage} offer. Limited time only!';
  headline1 = headline1.replace('{golfPackage}', adTemplate['Golf Package']).replace('{destination}', adTemplate['Destination']);
headline2 = headline2.replace('{discountPercentage}', adTemplate['Discount Percentage']);
description = description.replace('{destination}', adTemplate['Destination']).replace('{golfPackage}', adTemplate['Golf Package']);

// Log the created ad for demonstration purposes
Logger.log('Headline 1: ' + headline1);
Logger.log('Headline 2: ' + headline2);
Logger.log('Description: ' + description);
}

Instructions:

This example script assumes you have a Google Sheets document containing the dynamic elements for your ads. Make sure to replace YOUR_SPREADSHEET_URL with the URL of your Google Sheets document containing the ad template data. The sheet should have columns like 'Golf Package', 'Destination', and 'Discount Percentage'.

To use this script:

  1. Log in to your Google Ads account.
  2. Click on 'Tools & Settings' (wrench icon) in the top right corner.
  3. Under 'Bulk actions', select 'Scripts'.
  4. Click on the blue '+' button to create a new script.
  5. Give your script a name, and paste the provided script into the code editor.
  6. Replace YOUR_SPREADSHEET_URL with the URL of your Google Sheets document containing the ad template data.
  7. Save the script and click 'Run' to execute it.

The script will read the data from your Google Sheets document and create ads based on the dynamic elements provided in the sheet. In this example, the script only logs the created ad text to the Logger for demonstration purposes. You can replace the logging statements with actual Google Ads API calls to create ads in your account.

Ad Performance Tracker

This script tracks the performance of your ads by monitoring clicks, impressions, conversions, and other key metrics. It can also alert you when specific performance thresholds are met or not met, so you can make data-driven decisions for optimization.

function main() {
var MINIMUM_CLICKS
  = 100; // Set your desired minimum clicks threshold
var MINIMUM_CONVERSIONS = 10; // Set your desired minimum conversions threshold
var DATE_RANGE = 'LAST_30_DAYS';
  var report = AdsApp.report(
    'SELECT AdGroupId, AdGroupName, AdId, Headline, Impressions, Clicks, Conversions ' +
    'FROM AD_PERFORMANCE_REPORT ' +
    'WHERE Impressions > 0 ' +
    'DURING ' + DATE_RANGE
);

var rows = report.rows();
while (rows.hasNext()) {
    var row = rows.next();
    var adId = row['AdId'];
    var adGroupName = row['AdGroupName'];
    var headline = row['Headline'];
    var impressions = parseInt(row['Impressions']);
    var clicks = parseInt(row['Clicks']);
    var conversions = parseInt(row['Conversions']);

    if (clicks >= MINIMUM_CLICKS && conversions >= MINIMUM_CONVERSIONS) {
        Logger.log('Ad ID: ' + adId + ', Ad Group: ' + adGroupName + ', Headline: ' + headline);
        Logger.log('Impressions: ' + impressions + ', Clicks: ' + clicks + ', Conversions: ' + conversions);
        Logger.log('Performance: Good');

        // Add your desired actions for ads with good performance
    } else {
        Logger.log('Ad ID: ' + adId + ', Ad Group: ' + adGroupName + ', Headline: ' + headline);
        Logger.log('Impressions: ' + impressions + ', Clicks: ' + clicks + ', Conversions: ' + conversions);
        Logger.log('Performance: Needs Improvement');

        // Add your desired actions for ads with poor performance
    }
}
}
    

Instructions:

This example script retrieves ad performance data from the last 30 days, but you can change the DATE_RANGE variable to a different time frame if needed. The script checks if an ad has met the minimum clicks and conversions thresholds, and logs the performance accordingly.

To use this script:

  1. Log in to your Google Ads account.
  2. Click on 'Tools & Settings' (wrench icon) in the top right corner.
  3. Under 'Bulk actions', select 'Scripts'.
  4. Click on the blue '+' button to create a new script.
  5. Give your script a name, and paste the provided script into the code editor.
  6. Adjust the MINIMUM_CLICKS, MINIMUM_CONVERSIONS, and DATE_RANGE variables as needed.
  7. Save the script and click 'Run' to execute it.

The script will fetch the performance data for your ads and log the results. Based on the performance, you can take actions like pausing low-performing ads or increasing the budget for well-performing ads. To automate these actions, you can replace the logging statements with actual Google Ads API calls.

Why Golfstream?

Most of the golf courses we partner with don’t have the internal resources to manage programmatic advertising. With high barriers to entry and numerous complexities, golf courses typically settle with 3rd-party agencies. Because these “middleman” agencies rely on charging premiums on your ad spend, there becomes a conflict of interest and often very poor results.

This is why we created Golfstream! We love golf and we love marketing. We’ve created a direct-to-exchange platform that is specifically tailored for golf courses.

Say goodbye to reports that don’t equate to more tee times! GolfStream provides targeted campaigns that scale across all channels.

Exchanges & SSPs

Golfstream offers a global media supply source across display, mobile, native, connected tv, audio, and digital out of home.

  • Display, Video & Mobile

  • Digital Out of Home

  • Connected TV

  • Native

  • Audio

Get more information

Golfstream has been marketing golf courses for nearly 15 years. Our team has the expertise and knowledge to reach your target audience through the largest media exchanges on earth.

We offer a fully managed solution that allows you to sit back and enjoy real results. You’ll have a dedicated account manager that will start analyzing your goals and developing laser focused campaigns right away.