# Weighted QS average per campaign experiment

> Track how a Google Ads experiment impacts Quality Score for a single campaign over time.

This script monitors the average weighted Quality Score for one base campaign and its experiment
campaigns. It weights by impressions so high-volume keywords count more than low-volume ones. By
default it looks at the last 7 days, but you can switch it to the last 30 days or last business
week.

## Setup

1. Choose a base campaign name. The script automatically finds all related experiment campaigns
   whose names start with that same base name, so a clear naming convention is required: your
   experiment campaign name must include the original campaign name at the start, for example
   `1.2 search - nb - nike // 20230831 // more direct ad copy`.
2. Provide the URL of a template spreadsheet. The script copies this template and sends the
   results to the copy.

## What the script calculates

The script pulls keyword data from Google Ads and calculates:

- A weighted average Quality Score for each campaign in the date range
- A daily weighted Quality Score per campaign for each of the last 7 days

## The sheet views

- **Summary view (Sheet1)**: a compact log where each row shows today's date, the campaign name,
  the date range (for example `LAST_7_DAYS`) and the weighted average Quality Score.
- **Daily view (Sheet2)**: a day-by-day overview where each row shows the date, the campaign name
  and the daily weighted Quality Score.

This makes it easy to compare original vs. experiment campaigns on Quality Score, spot trends such
as improving or declining scores over the last week and keep a daily history for reporting.

## Tips

- Always start experiment campaign names with the exact same base name as the original campaign.
- Use a clear naming pattern that includes a date and what you changed, so you remember the test
  later.
- Run the script on a schedule to keep your Quality Score tracking up to date.
