# Google Analytics

### Obtain Google Tag ID from Google Analytics

1. In your Google Analytics dashboard, click on **Admin**
2. Click on **Data Collection and modification**
3. Click on **Data streams**
4. Click on your Web data stream
5. Click on **View tag instructions**
6. Click on **Install manually**
7. You can find your Google Tag ID at `gtag('config', 'G-123');` (in this example, the Google Tag ID would be 'G-123').
8. Copy your Google Tag ID and save it for the next step.

### Configure Google Analytics on your StatusPal status page

{% hint style="info" %}
Visit your StatusPal status page settings by clicking on <mark style="background-color:green;">Status page</mark> from the sidebar of your admin dashboard.
{% endhint %}

Once in your status page settings page, scroll down to find the **Custom Javascript** text field.

Enter the following Javascript code snipped, making sure to replace the value of the `GTAG_ID` variable ('G-123') with the value you copied from the previous step.

{% code fullWidth="false" %}

```javascript
var GTAG_ID = 'G-123'; // Replace the 'G-123' with your own value
var gtagScript = document.createElement('script');
gtagScript.async = true;
gtagScript.src = 'https://www.googletagmanager.com/gtag/js?id='+GTAG_ID;
document.head.appendChild(gtagScript);

window.dataLayer = window.dataLayer || [];
function gtag() {dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', GTAG_ID);
```

{% endcode %}

Click on the Update button at the bottom, and your Google Analytics integration should start working on your StatusPal status page.


---

# 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://docs.statuspal.io/platform/integrations/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.
