> For the complete documentation index, see [llms.txt](https://foodcommerce-api-help.onlinesales.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://foodcommerce-api-help.onlinesales.ai/user-tracking-events/js-sdk/installing-the-tag.md). Agents can also search and read this documentation through its [MCP server](https://foodcommerce-api-help.onlinesales.ai/~gitbook/mcp).

# Installing the Tag

To install the tag, we highly recommend that you add its base code between the opening and closing `<head>` tags on every page where you will be tracking website visitor actions. Most developers add it to their website's persistent header, so it can be used on all pages.

Placing the code within your `<head>` tags reduces the chances of browsers or third-party code blocking the pixel's execution. It also executes the code sooner, increasing the chance that your visitors are tracked before they leave your page.

### Base Code

Installing the tag requires you to add the below code in the`head` sections of your website on all pages.

The base pixel code contains your client ID at one place and looks like this:

```javascript
(function() { var a = document.createElement("script");a.type ="text/javascript"; 
a.async = true;a.src="https://c.o-s.io/__CLIENT_ID__/tracker.js";
var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(a,s); })();
```

{% hint style="warning" %}
\_\_CLIENT\_ID\_\_ should be replaced with the id provided by the onlinesales.ai integration team.
{% endhint %}

{% hint style="info" %}
In case of Social Media Manager(SMM), a unique \_\_CLIENT\_ID\_\_ would be assigned to each seller/merchant and the tag would be placed on that seller/merchant's individual website.
{% endhint %}

### Installing Using Google Tag Manager

The above base code is compatible with Google Tag Manager. You can create a new tag under the Google tag manager to install the same.

### Mobile Websites

If your mobile website is separate from your desktop website, we recommend that you add the pixel to both.
