# Google Tag Manager Integration

## Tracking with Google Analytics or Google Tag Manager

Configure the `tracking` object in your `ss360Config` to enable external tracking:

```
var ss360Config = {
   tracking: { 
      providers: ['GA'],
      searchCallback: function(query) {
         return true;
      }
   }
};
```

Supported providers: `'GA'` (Google Analytics), `'GTM'` (Google Tag Manager).

This adds a `?ss360Query={query}` parameter to search result pages. To view search terms in Google Analytics, configure the URL query parameter as described in [Google's documentation](https://support.google.com/analytics/answer/1012264?hl=en).

***

## Setting Up via a GTM Container

1. In Google Tag Manager, create a new tag and select **Custom HTML** as the tag type.
2. Add the code snippet below, replacing `mysiteid.com` with your site ID (found under [Account > General](https://app.sitesearch360.com/account/general)) and configuring your `ss360Config` parameters.
3. Set the trigger to **All pages**, save, and publish.

**Using the bundled script (recommended):**

```
<script async src="https://js.sitesearch360.com/plugin/bundle/0000.js"></script>
```

Replace `0000` with the code generated from the **Design & Publish** section of your project.

**Using the legacy script:**

```
window.ss360Config = {
   siteId: 'mysiteid.com',
   searchBox: {/*...*/}
};
                           
var e=document.createElement("script");
e.src="https://cdn.sitesearch360.com/v15/sitesearch360-v15.min.js";
document.getElementsByTagName("body")[0].appendChild(e);
```
