> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pocketflows.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Ads Lifecycle

When a end-consumer visits a booking flow through an ad, a number of things
happen from first landing on the page to final checkout. Pocketflows is involved
in many of these steps, which we'll outline here.

For the purposes of this walkthrough, we'll adopt the persona of an average
consumer signing up for a haircut. The business is called "Haircuts for Days"
— they host their website at `haircutsfordays.com` and use the SaaS
platform `haircut.ai` to manage appointment scheduling.

# Consumer Lifecycle

| Consumer Journey                                                                                                                                                                                         | What Pocketflows Does                                                                                                                                                                                                                                                      |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 1. Consumer searches "haircuts near me" on Google. `haircutsfordays.com` shows up in the "Sponsored Results" section.                                                                                    |                                                                                                                                                                                                                                                                            |
| 2. Consumer clicks on that result - they are taken to `haircutsfordays.com?gclid=XXXX&gad_campaign_id=XXXX`                                                                                              | Pocketflows is loaded as a [script](/quickstart/ads#step-2-install-the-tracking-script) on `haircutsfordays.com`. From this, Pocketflows stores the `gclid` and `gad_campaign_id` params as well as generates a unique identifer for the consumer                          |
| 3. After navigating around on the site, consumer clicks the "Schedule Appointment" button on the site and is taken to `app.haircut.ai/haircutsfordays/schedule?gclid=XXXX&gad_campaign_id=XXXX&pai=XXXX` | The same [Pocketflows script](/quickstart/ads#step-2-install-the-tracking-script) loaded on `haircutsfordays.com` automatically decorates links to `app.haircut.ai` with the necessary parameters to continue conversion tracking once the consumer switches websites      |
| 4. During checkout on `app.haircut.ai`, the consumer is prompted to create an account or sign in on the platform.                                                                                        | The same [Pocketflows script](/quickstart/ads#step-2-install-the-tracking-script) is loaded on `app.haircut.ai` and after the consumer is signed in, the web page calls `.track('identify', { customer_id: 'cust_XXXX' })` with a Pocketflows customer ID (or external ID) |
| 5. Consumer finishes checkout and schedules their appointment.                                                                                                                                           | On the server-side of `app.haircut.ai`, a `POST /businesses/:id/track` request is made to Pocketflows which notifies us of the purchase and the customer. From there, we are able to stitch together the consumer's journey and the subsequent ad attribution              |
