> For the complete documentation index, see [llms.txt](https://documentation.ajaxsearchpro.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.ajaxsearchpro.com/analytics-integration/events-tracking.md).

# Tracking with Google Site Tag (gtag.js)

## Google Tag Tracking code installation

For events tracking the [GA4 gtag.js](https://support.google.com/analytics/answer/9304153) must be installed for your webpage. For more information what the gtag is check the [Google Tag](https://developers.google.com/tag-platform/gtagjs) documentation.

The tracking code should look something like this, and should be in your site header:

```javascript
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-1234567890"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'G-1234567890');
</script>
```

After the tag installation see the [Events Tracking](/analytics-integration.md#events-tracking) to setup the desired events to track.
