# Google Search Console

> Sync Google Search Console into your warehouse: sign in with Google or add Orcabase as a user, and get clicks, impressions and positions by day, search and page.

Source: https://orcabase.co/docs/data/google-search-console

Sync a Google Search Console property into your warehouse: clicks, impressions, click-through rate and average position, by day, search, page, country and device. The copy refreshes on a schedule, so you can ask about search next to the rest of your business.

## Before you start

- A Google account that can see the property in Search Console, or permission to add a user to it.
- A warehouse in Orcabase for the data to land in: the [built-in warehouse](https://orcabase.co/docs/data/warehouse), or a [BigQuery](https://orcabase.co/docs/data/bigquery) data source.
- The **Admin** role in your workspace.

## Sync a property

1. **Pick Google Search Console**

   Go to **Data Sources → Data sync → Add source** and pick **Google Search Console**, under **Built into Orcabase**.

2. **Connect, one of two ways**

   **Sign in with Google** (the quickest): click the button, sign in with an account that can see the property, and allow read-only access. Orcabase lists that account’s properties; pick one.

   **Add our service account**: the form shows an email address with a copy button. In Search Console, open **Settings → Users and permissions**, add that address with **Restricted** permission, then type the property: `sc-domain:example.com` for a domain property, or the URL prefix exactly as Search Console shows it, like `https://example.com/`. Use this way when no one wants to tie the sync to their own Google account.

3. **Choose how much history**

   Pick how far back the first sync reads: 30 days up to 16 months, the most Search Console keeps. Pick where it syncs into, then click **Connect**.

4. **Choose tables and a schedule**

   Tick the tables to sync, set the **Schema** (for example `gsc_example_com`) and how often to sync, then click **Start syncing**.

## What comes in

| Table | One row per |
| --- | --- |
| `search_analytics_by_date` | Day |
| `search_analytics_by_query` | Day and search |
| `search_analytics_by_page` | Day and page |
| `search_analytics_by_country` | Day and country (a three-letter code, like usa) |
| `search_analytics_by_device` | Day and device: desktop, mobile or tablet |
| `search_analytics_by_query_page` | Day, search and page: the largest table |
| `sitemaps` | Submitted sitemap, with its errors, warnings and submitted URLs |

Every search analytics table has `date`, its breakdown columns, then `clicks`, `impressions`, `ctr` and `position`. Average position is impression-weighted, so add it up across days with a weighted average rather than a plain one:

```sql
SELECT query,
       SUM(clicks) AS clicks,
       SUM(position * impressions) / SUM(impressions) AS avg_position
FROM gsc_example_com.search_analytics_by_query
WHERE date >= current_date - 28
GROUP BY query
ORDER BY clicks DESC
```

## How it syncs

- The first sync reads the history you picked. After that, each sync adds the new days and re-reads the last week, which Google keeps revising, and keeps every older day, so your history grows past Search Console’s 16 months. The sitemaps table is replaced in full each time.
- Google leaves rare searches out to protect people’s privacy, so the per-search tables add up to less than `search_analytics_by_date`.
- Days are Search Console’s own, in Pacific time.

> **Note**
>
> If the Google account’s access is revoked or the person leaves, the sync fails with a sign-in error. Open the sync and click **Reconnect** to sign in again, with the same account or another one that can see the property; you can also switch a service-account sync to signing in this way. For a service-account sync, add the address back under Users and permissions.

---

Previous: [Google Sheets](https://orcabase.co/docs/data/google-sheets.md) · Next: [MySQL](https://orcabase.co/docs/data/mysql.md)

All docs: https://orcabase.co/llms.txt
