Skip to main content

CPC bucket and heatmap script

This script helps you find the CPC level where your Google Ads campaigns stop being profitable and where you might be overpaying for clicks.

What this script does

This script looks at your campaign performance by hour and by day of the week. It checks how much you pay per click (CPC), how many conversions you get, and how valuable those conversions are.

It groups all this data into CPC “buckets”. For example, it can show you performance for clicks that cost between €0 and €1, €1 and €2, and so on. This makes it much easier to see at which CPC ranges your campaign still makes money and where it starts losing money.

The script sends everything into a Google Spreadsheet that is ready to use. You do not have to build anything yourself.

What you will see in the spreadsheet

After running the script, you will get a spreadsheet with several useful tabs:

  • CPC Buckets overview

    A table that shows per CPC range:

    • Clicks

    • Cost

    • Conversions

    • Conversion value

    • Conversion rate

    • Cost per conversion

    • Conversion value vs cost

    • Cumulative metrics that show what happens as CPC goes up

    This view helps you see:

    • At which CPC ranges you are still profitable

    • At which CPC level your results become unprofitable

    • What CPC range gives you the best balance between volume and profit

  • CPC Heatmap (by day and hour)

    A visual heatmap that shows your average CPC per day of the week and per hour of the day.

    You can quickly spot:

    • When you are paying the highest CPCs

    • Which days and hours are relatively cheap

  • CPA Heatmap (by day and hour)

    A second heatmap that shows your average cost per conversion (CPA) per day and hour.

    This helps you see:

    • When conversions are most expensive

    • When conversions are relatively efficient

These views together make it very clear when you are overpaying and where you could lower your bids.

How this helps you optimize CPC

The main goal of this script is to help you set a realistic max CPC per campaign.

With the data and graphs you can:

  • See exactly at which CPC level your account or campaign switches from profitable to unprofitable

  • Decide a max CPC that protects your profit

  • Understand the trade-off between:

    • Lower CPC and higher profit per conversion

    • Higher CPC and more volume, but lower or negative profit

It is important to remember:

  • Lowering your max CPC will often reduce your volume (fewer clicks and conversions)

  • But it can increase your overall profit, because you stop paying too much for each click

The script is there to give you clear, visual data so you can make this decision with confidence instead of guessing.

Best practices

  • Use enough days of data so your bucket and heatmap views are reliable, not just based on a few clicks.

  • Look at both CPC and CPA. Cheap clicks are not always good if CPA is very high.

  • Do not set your max CPC too tight after one run. Test, then check the script output again and adjust.

  • Use the day/hour heatmaps to align bid strategies or schedules with your most profitable times.

Did this answer your question?