> For the complete documentation index, see [llms.txt](https://docs.pulseinsights.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pulseinsights.com/implementing-pulse-insights-dev/implementing-on-web-and-mobile-web/single-page-apps.md).

# Single Page Apps

Pulse Insights handles single page apps natively with no additional changes or modifications on your part.&#x20;

## On State Change

State changes are treated like new pageviews, and Pulse Insights will evaluate whether a survey is eligible to be returned on each state change.&#x20;

{% hint style="warning" %}
Don't re-load the Pulse Insights tag on each state change. It adds unnecessary overhead and could even interfere with proper functioning.
{% endhint %}

{% hint style="info" %}
Some browser have a back forward cache that preserves the state of the page when users navigate via back/forward buttons. In this case, the page doesn't call Pulse Insights again. Since Pulse Insights wasn't called, we won't increment an impression or evaluate frequency caps, but the user experience will perform as expected.
{% endhint %}

## For tags deployed prior to 2019 intending to use Single Page Apps

We recommend adding the following line to your code snippet above `'get', 'surveys'`.

```javascript
pi('pushBeforeGet', true);
```

This command will push the state before making the serve call for surveys and will ensure that the serving logic is using the latest URL for survey targeting.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.pulseinsights.com/implementing-pulse-insights-dev/implementing-on-web-and-mobile-web/single-page-apps.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
