How to Import Google Analytics Data to Airtable

May 23, 2022Rosie Threlfall

In this guide, we'll import data from Google Analytics 4 into Airtable. We'll use the Data Fetcher Google Analytics Airtable integration to automatically pull in Google Analytics 4 metrics such as users, sessions & new users.

This guide is for Google Analytics 4 (GA4) which is replacing Universal Analytics (UA). If you are using Universal Analytics (UA) you can find the instructions at the bottom of this article. If you are not sure which version of Google Analytics you are using, you can find out here.

Install Data Fetcher

Install Data Fetcher from the Airtable marketplace. After the extension launches, sign up for a free Data Fetcher account by entering a password and clicking 'Sign up for free'. If you already have a Data Fetcher account, sign in using the 'Have an account?' button at the bottom left of the box.

Group 1Data Fetcher Sign Up .png

Import Google Analytics 4 Data to Airtable

On the home screen of the Data Fetcher extension, click 'Create your first request'. Requests in Data Fetcher are how you import data to or send data from your Airtable base.

click-create-your-first-request.png

On the create request screen in Data Fetcher, for Application, select 'Google Analytics 4' to use the Google Analytics Airtable integration.

GA4-application.png

Click 'New Google Analytics 4 Connection'.

GA4 authorization for Data Fetcher

You will be taken to a new tab/window where you need to authorize Data Fetcher to access your Google Analytics 4 account. Select the Google account you want to import Google Analytics 4 data from. On the next screen make sure you check the View and manage your Google Analytics data checkbox before clicking 'Continue'.

select-google-account.png

google-analytics-oauth-allow.png

You should now be back in the Data Fetcher interface with the Google Analytics 4 connection set up. Enter a Name for your request, e.g. 'Import GA Metrics'. Then click 'Save & Continue'.

Connect Google Analytics to Airtable

Select the Google Analytics 4 Account, Property and View you want to import data for.

google-analytics-account-property-view.png

Select the Date range you want to import data for, e.g. 'Last week'. Select the Fields you want to import from Google Analytics 4, e.g. 'Total Users', 'New users' & 'Sessions'.

GA4-date-users.png

Select a value for Split by to split the data into different records. e.g. select 'Date' to get a different record for each date.

google-analytics-split-by.png

Select the Output Table & View you want to import Google Analytics 4 data into.

output-table-1.png

Click 'Save & Run'.

GA4-import.png

(Optional) Filter what Google Analytics 4 Ads data is Imported

You can use filters to only import certain data from Google Analytics 4 based on specific criteria. In Data Fetcher, under Filters, click 'Add Filter', then select the conditions you want to filter.

For example, you could add a filter specifying that 'Page' does not contain '?'. This will ensure we do not import metrics for pages that are query parameters in Google Analytics (e.g. https://datafetcher.com/blog?search=shopify).

Google Analytics Filter out query params.png

The request will run and the Response field mapping modal will open. This is where you set how the fields from Google Analytics 4 will map to fields in the output table. For each Google Analytics field, you can either import or filter it. For an imported field, you can set whether to map them to an existing field or create a new field. Once you are happy, click 'Save & Run'.

GA4-mapping.png

Data Fetcher will create any fields that need to be created in the output table, then run the request and import the data from Google Analytics 4 to Airtable. If you want to run the request again, simply click 'Run'. If nothing has changed, you will not need to set up the response field mapping again.

GA4-output-table.png

Automatic Google Analytics Airtable Integration

With this setup, we'd have to manually run the Google Analytics Airtable integration to import the data from Google Analytics 4. We can use Data Fetcher's scheduled requests feature to automatically import this data every 15 minutes/ hour/ day etc.

In Data Fetcher, scroll to Schedule and click 'Upgrade'.

table-1-schedule-upgrade-button.png

A new window opens up for you to select a payment plan and enter your details to upgrade.

data fetcher upgrade pricing plans.png

Now return to the Data Fetcher extension and click 'I've done this'.

table-1-schedule-ive-done-this-button.png

Under Schedule click '+ Authorize'.

Schedule Data Fetcher

A window will now open where you'll be able to authorize the certain Airtable bases you would like Data Fetcher to have access to.

By selecting 'All current and future bases in all current and future workspaces' you'll avoid issues with unauthorized bases for future use.

Click 'Grant access'.

schedule-authorize-bases.jpg

You'll now see Schedule this request is toggled on.

Select how often you want the request to run. The Google Analytics Airtable integration will now run every Monday and automatically pull in Google Analytics 4 data for the previous week.

google-analytics-save.png

Import Google Universal Analytics (UA) Data to Airtable

To import Universal Analytics (UA) data into Airtable, follow all the instructions above but on the create request screen in Data Fetcher, for Application, select 'Google Analytics'.

GUA-connection.png

Import Google Analytics Metrics for Specific URLs Only

To import metrics for a list of URLs (and no other URLs), add your site's URLs in a table.

Make sure they are all exactly correct, e.g. ensure you do not have a mix of http and https at the start.

Google Analytics List of URLs.png

Set up the Google Analytics request in Data Fetcher by following all the instructions above, but for Split by, select 'Page path' instead of 'Date'. (If you're using UA rather than GA4, select 'Page'.)

ga4 split by page path .png

Under Filters, add a filter specifying that 'Page path' does not contain '?'. This will ensure we do not import metrics for pages that are just query parameters in Google Analytics (e.g. https://datafetcher.com/blog?search=shopify).

ga4 filters.png

Scroll to the bottom of the screen and click 'Advanced settings'.

Under Write mode, click 'Update'. You can learn more about write modes here.

change write mode to update.png

Next, toggle off 'Create records leftover after update'. This means Data Fetcher will only update the existing records in the table, without creating new ones.

turn off create records leftover after update.png

Scroll down to Update Based on Field, and select the 'URL' field in your table.

change update based on field to url.png

Click 'Save & Run' to run the request and open the Response field mapping.

The URLs in our table look like https://datafetcher.com/airtable-integrations but the page paths from Google Analytics look like /airtable-integrations. So we need to use a formula to add the 'https://datafetcher.com' and ensure the Google Analytics URLs can be matched to the ones in our table.

On the Response field mapping, for the 'Page path' field, select 'Existing field' and map it to the 'URL' field in your table.

Then click on the settings icon next to the 'Page path' field.

ga4 page path settings.png

The settings for the field will open. Under Formula, enter the following formula.

CONCATENATE("https://YOUR_DOMAIN",value)

Make sure you replace YOUR_DOMAIN with your actual domain, e.g. datafetcher.com in this example.

After entering the formula, click the 'Save' button.

page path formula save button.png

Click 'Save & Run'. The Google Analytics Airtable integration will now run and import metrics only for the URLs in your table.

ga4 data imported.png

If you don't see any data imported, it's because Data Fetcher is failing to match up the URLs returned by Google Analytics and those in your table. The easiest way to troubleshoot this is to turn 'Create records leftover after update' back on, run the request, and compare the imported URLs with those that were in your table before. You can then adjust the formula on the response field mapping as neeeded.

Related Posts

How to Import Google Sheets Data to Airtable

How to Import Google Sheets Data to Airtable

Aug 24, 2022

Rosie Threlfall

Google
How to Import Google Ads Data to Airtable

How to Import Google Ads Data to Airtable

May 26, 2022

Rosie Threlfall

Google