Setting Up The WooCommerce Google Ads API

Alpha Insights Documentation

Google Ads API Configuration

What Does This Feature Do?

This is by far one of our most requested features and the feature that we also think will bring the most value to Alpha Insights.

This feature does a number of things, it essentially bridges the data gap between your WooCommerce store and your Google Ads account.

This feature does a few things:

  1. It will automatically import expenses from your Google Ad spend to calculate your store’s profit reliably without intervention from you
  2. It will produce a report (a small sample of the report above) to display key metrics and overviews for your entire ad account and specific campaigns.
  3. We also use the API to check which orders belong to which campaigns, outside of the usual Google attribution (providing more accurate results).
    This means that we can assess the ACTUAL profitability of your Google Campaigns as we have all revenue collected, all costs & a comparison against each campaign. This will allow you to truly calculate the profitability of your campaigns. 
    You can also set the utm_campaign for a given Google Campaign, and we will scan your database for a match with orders, to further enhance Alpha Insights ability to tie your orders to Google Campaigns. As such, we’d recommend you always use a utm_campaign query parameter in your Google Campaigns, and set them in our plugin to ensure accurate reporting.
We have plans to implement the same feature for Facebook too.

Setting Up Your API Connection

1. Login To The Google Ads API

Go to Alpha Insights > Settings > Google Ads

On this page you will find the Login WIth Google button, click this and follow the prompts.

You will be asked to login to Google, request relevant permissions, and asked to select the appropriate Google Account.

Please note, you can only configure one account per installation for the time being.

If succesful, you should be returned to your settings page with

2. Select A Google Ad Account

When you log into and authenticate your connection with the Google API, we fetch for all available ad accounts that you have access to under that google account, and store them for you to use for your API configuration.

If you do not have the appropriate permission to access that Google Ad Account within the Google Account you logged in through, it will not show up, so make sure that you have the relevant permissions on a particular ad account that you are trying to configure under the Google Account that you logged in to.

If you feel like you have not got the ad accounts available that you think you should, you can use the Fetch for Available Ad Accounts button which will re-check your account for available ad accounts that you have access to.

That’s it, once you see a green dot on both section then you are configured.

If you run into any issues, they will normally display as messages at the top of this settings page, or will be available at the bottom of this settings page under the error log.

3. Once You’re Configured You Should Fetch For Data:

There is an automatic process that fetches and stores data, but if you’re keen to hit the ground running just hit the Refresh All Data button at the top right of the settings page.

This will fetch and store all expenses and data points to be used in expense calculation and campaign reports.

The Settings

API Call Schedule

This determines how frequently we should fetch for data from your Google Ad Account. The more often you are fetching the more tolling it is on your server, so if you’re concerned about performance i’d leave it to once a day.

This fetch will collect and store expenses and also collect campaign data and store it within a campaign custom post type.

Collect Campaign Insights

This True or False setting will decide whether or not we store campaign analytics as a custom post type, if set to no we will not collect any campaign data.

Collect Daily Ad Spend (Stored as an expense)

This True or False setting will decide whether or not we store expense data to be used in total store profit calculations.

Set this to false if you don’t want to store expenses.

Ad Spend Expense Category

This is the expense category in which we will store your Google Campaign Ad spend against, we will try create one, otherwise you can create one or select an existing one.

Ad Account Age (Years)

When we check for all time data, we will search back this many years.

The Google API does not allow us to just search all time, we need to set specific dates, so by default we will search up to 10 years back.

If your ad account is older than 10 years you can set this to a higher number, but it may create a very large request that may not be succesful depending on how active you are in Google Ads.

utm_campaign Identifiers

This is a feature that will allow you to create an association between your orders & your Google Campaigns via a utm_campaign.

If you use utm_campaign’s in your Google Campaigns (we recommend you do) then we will check the order’s stored utm_campaign against your configured settings below to help determine which orders belong to which campaigns.

This feature will run automatically in the background every hour, and search through the last 30 days worth of orders, provided that you have configured the setting.

This is a backup feature, by default Alpha Insights will also check your stored GCLID’s (don’t worry this all happens without any effort on your part) to try and associate orders with Google Campaigns, but this will help with attribution.

If you use utm_campaigns on each of your Google campaigns, we recommend you fill out these settings.

The Google Campaigns that are loaded will be the ones that are automatically pulled in by the API request, or if you make the Google Campaigns via the Google Ads > Manage Campaigns menu item.

The values to be entered into this setting is simply the utm_campaign that you set in your campaign.

You do not need to include the utm_campaign component or the ?, only the value.

Important Notes

Connecting Orders to Google Campaigns

Alpha Insights will attempt to connect your orders to specific Google Campaigns.

The way it does is by using the GCLID click that we store against your order, which will happen automatically every hour.

You will be able to see if we have a saved GCLID on the orders page on the order overview provided by Alpha Insights – you can also manually associate the order to a Google Campaign from the order page.

This feature works by searching the stored GCLID from your order, against your ad account to find the campaign that click belongs to.

This feature will run automatically in the background, every hour. Once it has checked an order once, it will not check it again.

If we find the campaign ID, we store that against your order which is used for all profit calculation on the report page.

Please note: This will only search through 30 days worth of clicks. If the order is older than 30 days or there is no GCLID stored then we will not be able to associate a campaign to this order.

There is a secondary feature to further enhance your order attribution to your Google Campaigns which is in the utm_campaign identifier settings outlined above. 

This feature will run hourly and you can trigger it manually within your settings dashboard.

The Google Campaign Report Page

All of the revenue and orders reported on the Google Campaign Report are from our association of your orders with Google Campaigns.

If we could not match an order to a Google Campaign via the API, the revenue will not be reported.

We do store the amount of revenue that Google reports against a campaign, although you will not see that appear in the reports really, that is information that you can find in your Google account so we don’t report on that.

This means that our profit calculations for your campaigns are extremely accurate, provided all orders are accounted for via the API.

Best case scenario if you are an existing user, you will be able to fetch back through a maximum of 30 days of order data, provided they have a stored GCLID by us or you have configured the correct utm_campaign value for the campaign.


Any errors in the Google API will be logged and reported at the bottom of your Google Ads setting page within Alpha Insights.

Most errors are temporary, they are most likely to be timeout issues, which are not permanent and do not effect the ongoing capacity of your installation.

For any queries or concerns, you can reach us at