# Snippet sequence

URL: https://docs.ablyft.com/developers/installation/snippet-sequence/

> The order in which the snippet loads, activates pages and delivers experiments.



This page describes what the snippet does on every page view, in order. It is the canonical description of the delivery
order; other pages link here.

## The sequence

1. **The snippet loads.** It is requested from the CDN (see [Publishing](https://docs.ablyft.com/developers/installation/publishing/)).
2. **Prerequisites are checked.** If a prerequisite rule fails (for example a missing consent), the project is not
   activated and nothing else happens. See [Requirements](https://docs.ablyft.com/developers/installation/requirements/) and
   [Snippet settings](https://docs.ablyft.com/developers/installation/snippet-settings/).
3. **Project JavaScript and CSS run.** The code you defined for the whole project is executed.
4. **Pages are activated.** Each page is activated by its trigger: `direct`, `url_change`, `dom_change`, `callback`,
   `polling` or `api`. See [Pages](https://docs.ablyft.com/guides/audiences-and-delivery/pages/).
5. **Page conditions are checked.** The URL targeting and the JavaScript rules of the page must match. If they do not,
   the page is not activated.
6. **For each experiment of an activated page:**

   1. **The experiment is activated.**
   2. **The environment is checked** with its JavaScript rules, see
      [Environments](https://docs.ablyft.com/guides/audiences-and-delivery/environments/).
   3. **The audiences are checked** with their JavaScript rules, see
      [Audiences](https://docs.ablyft.com/guides/audiences-and-delivery/audiences/).

   If the environment or the audience check fails, the experiment is not activated.
7. **The experiment is executed.** First the experiment-level JavaScript and CSS run, then the JavaScript and CSS of the
   variation the visitor is assigned to.
8. **Integrations are executed**, one after the other.

> [Exclusion groups](https://docs.ablyft.com/guides/experiments/exclusion-groups/) and [traffic allocation](https://docs.ablyft.com/guides/audiences-and-delivery/traffic-allocation/)
> are applied when the experiment is delivered, that is when the visitor is assigned to a variation.

> With debug mode on, the browser console shows the result of each step. See
> [Debug mode](https://docs.ablyft.com/developers/debugging/preview-and-live-log/#debug-mode).

