# OAuth Authentication for Google Analytics

**Recommended Approach**

For enterprise use cases, we recommend using a [Service Account](https://helpdesk.smaply.app/integrations/metrics-tools/google-analytics/creating-google-service-account) instead of OAuth. Service Accounts provide more secure and scalable access to Google Analytics data. However, if you prefer OAuth or have specific requirements, follow the steps below.

### Prerequisites[​](https://geoffbullen.github.io/smaply-knowledge/docs/documentation/metrics/integrations/google-analytics/Administration/o-auth#prerequisites)

A Google account with access to the desired Google Analytics properties

### OAuth Authentication Process[​](https://geoffbullen.github.io/smaply-knowledge/docs/documentation/metrics/integrations/google-analytics/Administration/o-auth#oauth-authentication-process)

#### 1. Initiate OAuth Flow[​](https://geoffbullen.github.io/smaply-knowledge/docs/documentation/metrics/integrations/google-analytics/Administration/o-auth#1-initiate-oauth-flow)

1. Click the "Connect to Google Analytics" button in Smaply
2. You will be redirected to Google's OAuth consent screen

#### 2. Grant Permissions[​](https://geoffbullen.github.io/smaply-knowledge/docs/documentation/metrics/integrations/google-analytics/Administration/o-auth#2-grant-permissions)

1. Sign in with your Google account (if not already signed in)
2. Review the permissions requested by Smaply
3. Click "Allow" to grant access to your Google Analytics data

#### 3. Verify Account Suitability[​](https://geoffbullen.github.io/smaply-knowledge/docs/documentation/metrics/integrations/google-analytics/Administration/o-auth#3-verify-account-suitability)

After granting permissions, Smaply will automatically check:

* If your account has access to any Google Analytics properties
* The list of properties you have access to
* Your permission level for each property (e.g., Read & Analyze, Edit, Manage Users, etc.)

{% hint style="warning" %}
***Note:** Ensure you're using a Google account that has the necessary permissions for the Google Analytics properties you want to integrate with Smaply.*
{% endhint %}

### Troubleshooting[​](https://geoffbullen.github.io/smaply-knowledge/docs/documentation/metrics/integrations/google-analytics/Administration/o-auth#troubleshooting)

If you encounter issues during the OAuth process or property verification:

1. **No properties available**: Ensure your Google account has access to at least one Google Analytics property
2. **Insufficient permissions**: Check your access level in Google Analytics. You need at least "Read & Analyze" permissions for the properties you want to integrate
3. **OAuth errors**: Try clearing your browser cache and cookies, then attempt the process again

{% hint style="info" %}
***Tip**: If problems persist, contact your Google Analytics administrator to verify your account permissions, or reach out to Smaply support for assistance.*
{% endhint %}

{% hint style="warning" %}
***Token Expiration:** OAuth tokens have an expiration period. Smaply will handle token refresh automatically, but ensure you don't revoke the app's permissions in your Google account to maintain uninterrupted access.*
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://helpdesk.smaply.app/integrations/metrics-tools/google-analytics/oauth-authentication-for-google-analytics.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
