# Engagement

## Screenshot

![Audience: Engagement Dashboard using test data](/files/-MaFAYdOhZ4w2Abno6nC)

## Requirements

The following items are required to build this dashboard.

* Web Analytics Tracking with the following events
  * Pageviews

## Steps to building this dashboard

1. Create a View
2. Create a dashboard
3. Add Sessions Tile
4. Add Pageviews Tile
5. Add Session Duration Bucket
6. Add Sessions by Duration Tile
7. Add Pageviews by Duration Tile

## 1. Create a View

Configure the view using the below parameters

| Title            | Type  | Auto Dimensions | Timestamp  |
| ---------------- | ----- | --------------- | ---------- |
| Session Duration | Query | None            | create\_ts |

Copy and paste the following script into the **SQL** box and save:

```sql
with ssd as
(select p.visit_id,p.page_url,count(p.id) as page_views,v.create_ts, max(p.create_ts) as last_action_ts,
            abs(datediff(s,max(p.create_ts),v.create_ts)) as session_duration,
            case 
            when session_duration >= 0 and session_duration <= 10 then '0 - 10 seconds'
  					when session_duration >= 11 and session_duration <= 30 then '11 - 30 seconds'
 						when session_duration >= 31 and session_duration <= 60 then '31 - 60 seconds'
 						when session_duration >= 61 and session_duration <= 180 then '61 - 180 seconds'
 						when session_duration >= 181 and session_duration <= 600 then '181 - 600 seconds'
 						when session_duration >= 601 and session_duration <= 1800 then '601 - 1800 seconds'
            else '1801+seconds'
            end as session_bucket
            from _fxm_events p
            join _fxm_visits v on v.id = p.visit_id
 						where p.name = '_fxm.pages.view' and 
            (create_ts between '{{start_timestamp}}' and '{{end_timestamp}}')
            group by p.visit_id,v.create_ts,p.page_url             
 ) 
 select * from ssd
```

{% hint style="info" %}
&#x20;Super-powers are granted randomly so please submit an issue if you're not happy with yours.
{% endhint %}

Once you're strong enough, save the world:

{% code title="hello.sh" %}

```bash
# Ain't no code for that yet, sorry
echo 'You got to trust me on this, I saved the world'
```

{% endcode %}

## 2. Create a new dashboard

.... continue here...

## 3. Add Sessions Tile

Description of what this tile is and what it represents and how its calculated.

## 5. Add Session Duration Bucket

Description of what this tile is and what it represents and how its calculated.

![](/files/-MaFGyhmlb7R4TbL9YWr)

Also describe each column and what each one means and how its calculated

| Column          | Description                                                                                                        |
| --------------- | ------------------------------------------------------------------------------------------------------------------ |
| Session\_Bucket | *Lorem ipsum*, or lipsum as it is sometimes known, is dummy text used in laying out print, graphic or web designs. |
| Pageviews\_sum  | *Lorem ipsum*, or lipsum as it is sometimes known, is dummy text used in laying out print, graphic or web designs. |
| Sessions Count  | *Lorem ipsum*, or lipsum as it is sometimes known, is dummy text used in laying out print, graphic or web designs. |


---

# 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://docs.foxmetrics.com/templates/google-analytics/audience/engagement.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.
