# 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.


---

# 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://foodcommerce-api-help.onlinesales.ai/user-tracking-events/js-sdk/installing-the-tag.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.
