# Tracking Code (Analytics)

Please apply the following analytics tracking code to the head section of your webpages for accurate, anonymous tracking of page views for all API generated pages.

## Directory

Record analytics for your organizations’ directory endpoint.`corporate_username` value is a string and should be dynamically written from the API response as it can change.

```javascript
<script src="//d2mo5pjlwftw8w.cloudfront.net/analytics/analytic.ly.min.v1.0.2.js"></script>
<script type="text/javascript">
analyticly.track({
    asset_type : analyticly.TYPES.DIRECTORY,
    corporate_username : <CORPORATE_USERNAME>
});
</script>
```

## Expert/Staff

Record analytics for your organizations’ expert/staff endpoint. `corporate_username/expert/staff` username value is a string and should be dynamically written from the API response as it can change.

```javascript
<script src="//d2mo5pjlwftw8w.cloudfront.net/analytics/analytic.ly.min.v1.0.2.js"></script>
<script type="text/javascript">
analyticly.track({
    asset_type : analyticly.TYPES.USER,
    corporate_username : <CORPORATE_USERNAME>
    attr : {
        username : <USERNAME>
    } 
});
</script>
```

## Posts Listing

Record analytics for your organizations’ spotlight search endpoint. `corporate_username` value is a string and should be dynamically written from the API response as it can change.

```javascript
<script src="//d2mo5pjlwftw8w.cloudfront.net/analytics/analytic.ly.min.v1.0.2.js"></script>
<script type="text/javascript">
analyticly.track({
   asset_type : analyticly.TYPES.SPOTLIGHT,
   corporate_username : <CORPORATE_USERNAME>
});
</script>
```

## Full Post

Record analytics for your organizations’ spotlight post endpoint. `corporate_username` is a string and should be dynamically written from the API response as it can change. Same goes for spotlight post value.

```javascript
<script src="//d2mo5pjlwftw8w.cloudfront.net/analytics/analytic.ly.min.v1.0.2.js"></script>
<script type="text/javascript">
analyticly.track({
    asset_type : analyticly.TYPES.SPOTLIGHT,
    corporate_username : <CORPORATE_USERNAME>,
    attr : {
        post_id : <POST_ID>
    } 
});
</script>
```

## Q\&A Listing

Record analytics for your organizations’ questions search endpoint. `corporate_username` value is a string and should be dynamically written from the API response as it can change.

```javascript
<script src="//d2mo5pjlwftw8w.cloudfront.net/analytics/analytic.ly.min.v1.0.2.js"></script>
<script type="text/javascript">
analyticly.track({
   asset_type : analyticly.TYPES.SPOTLIGHT,
   corporate_username : <CORPORATE_USERNAME>
});
</script>
```

## Q\&A Posts

Record analytics for your organizations’ question endpoint. `corporate_username` is a string and should be dynamically written from the API response as it can change. Same goes for question value.

```javascript
<script src="//d2mo5pjlwftw8w.cloudfront.net/analytics/analytic.ly.min.v1.0.2.js"></script>
<script type="text/javascript">
<script type="text/javascript">
analyticly.track({
   asset_type : analyticly.TYPES.QANDA,
   corporate_username : <CORPORATE_USERNAME>,
   attr : {
       question_id : <QUESTION_ID>
   } 
});
</script>
</script>
```


---

# 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://developer.expertfile.com/reference/tracking-code-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.
