# Как настроить счетчик для Single Page Application?

Если ваш ресурс является одностраничным веб-приложением (Single page application или SPA) и динамически подгружает контент сайта, то для корректного подсчета статистики вам необходимо будет добавить вызов функции **trackPageView** в тот момент, когда вы хотите зафиксировать показ новой страницы.

**window\.top100Counter.trackPageview();**

В случае, если на вашем ресурсе для навигации по страницам используются хэши, то их можно считать, передав в настройки флаг **trackHashes**:

&#x20;**var options = {**

&#x20;    **project: /***номер вашего счетчика***/,**

&#x20;    **trackHashes: true**

**};**


---

# 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://top-100-writer.gitbook.io/dokumentaciya-top-100-po-novoi-modeli-progress/prakticheskie-primery-i-ispolzovanie-cook-book/vse-pro-ustanovku-schyotchika-top-100/kak-nastroit-schetchik-dlya-single-page-application.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.
