Skip to content

[Docs] - New Guides #7718

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
213 changes: 213 additions & 0 deletions docs/docs/guides/ga4-guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
---
title: "Google Analytics Guide"
sidebar_label: "Google Analytics (GA4) Demo"
sidebar_position: 5
tags:
- Tutorial
- Quickstart
- Example Project
---

# Google Analytics (GA4) Demo Guide

Rill makes it easy to visualize your GA4 data, empowering you to explore trends in website activity and make data-driven decisions with flexible, interactive analysis.

:::note prerequisites
Before you begin, ensure you have:
- [Exported your GA4 data to BigQuery](https://support.google.com/analytics/answer/9823238?hl=en#step2&zippy=%2Cin-this-article)
- [A service account key with access to BigQuery](https://cloud.google.com/bigquery/docs/use-service-accounts)

You can explore the dataset directly in BigQuery:
[GA4 Sample Dataset on BigQuery](https://console.cloud.google.com/bigquery?p=bigquery-public-data&d=ga4_obfuscated_sample_ecommerce&t=events_20210131&page=table&ref=ga4bigquery.com&inv=1&invt=Ab3HlA&project=rilldata)
:::

## Introduction

This guide will walk you through each step, from ingesting your GA4 data to building and exploring interactive dashboards in Rill.

---

## Step 1: Ingest Data

<img src='/img/guides/ga4/add-source.png' class='rounded-gif' />
<br />

Start by connecting to your GA4 data source. For this guide, we’ll use Google’s public GA4 dataset, which is available in BigQuery.

:::note Static Data
The data provided by Google is a static dataset with data from November 2020 to 2021.
:::

<img src='/img/guides/ga4/source-single-day.png' class='rounded-gif' />
<br />

When selecting BigQuery, Rill will prompt for:
```
`SQL` : select * from project_id.dataset.table; #select * from `bigquery-public-data.ga4_obfuscated_sample_ecommerce.events_20210131`
`project_id`: your google console project_id
`name`: name of source in Rill
```

### Partitioned GA4 Data

<img src='/img/guides/ga4/bigquery-partitioned.png' class='rounded-gif' />
<br />

If you are following along with this guide, use the following public dataset:

- **Project:** `bigquery-public-data`
- **Dataset:** `ga4_obfuscated_sample_ecommerce`
- **Table prefix:** `events_*`

If you are using your own data, you can make use of GA4's partitioned data using the `__TABLE_SUFFIX` parameter.

<img src='/img/guides/ga4/source-bigquery-suffix.png' class='rounded-gif' />
<br />

---

## Step 2: Expand the Columns

After connecting your data, you may want to expand nested columns or flatten the event structure for easier analysis by creating a model.

<img src='/img/guides/ga4/create-model.png' class='rounded-gif' />
<br />

:::tip Rill's Default Embedded Database, DuckDB
By default, Rill uses DuckDB as its underlying embedded database. This means that for any modeling, this will be done in DuckDB SQL.
:::

<img src='/img/guides/ga4/model.png' class='rounded-gif' />
<br />

<details>
<summary>Sample Model SQL</summary>

```SQL
SELECT
event_date,
user_pseudo_id,
to_timestamp(event_timestamp/ 1000000) as event_timestamp, -- convert 1608921004450512 to a proper timestamp
to_timestamp(user_first_touch_timestamp / 1000000) as user_first_touch_timestamp, --convert 1608921004450512 to timestamp, used to count time of session later

stream_id,
platform,
event_name,
event_value_in_usd,
event_bundle_sequence_id,

-- privacy_info
-- json_extract(main.privacy_info, '$.ads_storage')::VARCHAR AS priv_info_ads_storage,
-- json_extract(main.privacy_info, '$.analytics_storage')::VARCHAR AS priv_info_analytics_storage,
-- json_extract(main.privacy_info, '$.uses_transient_token')::VARCHAR AS priv_info_uses_transient_token,

-- user_ltv
json_extract(main.user_ltv, '$.currency')::VARCHAR AS ltv_currency,
CAST(json_extract(main.user_ltv, '$.revenue') AS DOUBLE) AS ltv_revenue,

-- device
-- json_extract(main.device, '$.advertising_id')::VARCHAR AS device_advertising_id,
json_extract(main.device, '$.category')::VARCHAR AS device_category,
-- json_extract(main.device, '$.is_limited_ad_tracking')::VARCHAR AS device_is_limited_ad_tracking,
json_extract(main.device, '$.language')::VARCHAR AS device_language,
json_extract(main.device, '$.mobile_brand_name')::VARCHAR AS device_mobile_brand_name,
-- json_extract(main.device, '$.mobile_marketing_name')::VARCHAR AS device_mobile_marketing_name,
json_extract(main.device, '$.mobile_model_name')::VARCHAR AS device_mobile_model_name,
-- json_extract(main.device, '$.mobile_os_hardware_model')::VARCHAR AS device_mobile_os_hardware_model,
json_extract(main.device, '$.operating_system')::VARCHAR AS device_operating_system,
json_extract(main.device, '$.operating_system_version')::VARCHAR AS device_operating_system_version,
-- CAST(json_extract(main.device, '$.time_zone_offset_seconds') AS INT) AS device_time_zone_offset_seconds,
-- json_extract(main.device, '$.vendor_id')::VARCHAR AS device_vendor_id,
json_extract(main.device, '$.web_info.browser')::VARCHAR AS device_browser,
json_extract(main.device, '$.web_info.browser_version')::VARCHAR AS device_browser_version,

-- geo
json_extract(main.geo, '$.city')::VARCHAR AS geo_city,
json_extract(main.geo, '$.continent')::VARCHAR AS geo_continent,
json_extract(main.geo, '$.country')::VARCHAR AS geo_country,
-- json_extract(main.geo, '$.metro')::VARCHAR AS geo_metro,
json_extract(main.geo, '$.region')::VARCHAR AS geo_region,
json_extract(main.geo, '$.sub_continent')::VARCHAR AS geo_sub_continent,

-- traffic_source
json_extract(main.traffic_source, '$.medium')::VARCHAR AS traffic_medium,
json_extract(main.traffic_source, '$.name')::VARCHAR AS traffic_name,
json_extract(main.traffic_source, '$.source')::VARCHAR AS traffic_source,

-- ecommerce
CAST(json_extract(main.ecommerce, '$.purchase_revenue') AS DOUBLE) AS ecommerce_purchase_revenue,
CAST(json_extract(main.ecommerce, '$.purchase_revenue_in_usd') AS DOUBLE) AS ecommerce_purchase_revenue_in_usd,
CAST(json_extract(main.ecommerce, '$.refund_value') AS DOUBLE) AS ecommerce_refund_value,
CAST(json_extract(main.ecommerce, '$.refund_value_in_usd') AS DOUBLE) AS ecommerce_refund_value_in_usd,
CAST(json_extract(main.ecommerce, '$.shipping_value') AS DOUBLE) AS ecommerce_shipping_value,
CAST(json_extract(main.ecommerce, '$.shipping_value_in_usd') AS DOUBLE) AS ecommerce_shipping_value_in_usd,
CAST(json_extract(main.ecommerce, '$.tax_value') AS DOUBLE) AS ecommerce_tax_value,
CAST(json_extract(main.ecommerce, '$.tax_value_in_usd') AS DOUBLE) AS ecommerce_tax_value_in_usd,
-- CAST(json_extract(main.ecommerce, '$.total_item_quantity') AS INT) AS ecommerce_total_item_quantity,
json_extract(main.ecommerce, '$.transaction_id')::VARCHAR AS ecommerce_transaction_id,
-- CAST(json_extract(main.ecommerce, '$.unique_items') AS INT) AS ecommerce_unique_items,

-- items (exploded)
-- json_extract(item.value, '$.affiliation')::VARCHAR AS value_item_affiliation,
-- json_extract(item.value, '$.coupon')::VARCHAR AS value_item_coupon,
json_extract(item.value, '$.creative_name')::VARCHAR AS value_creative_name,
-- json_extract(item.value, '$.creative_slot')::VARCHAR AS value_creative_slot,
json_extract(item.value, '$.item_brand')::VARCHAR AS value_item_brand,
json_extract(item.value, '$.item_category')::VARCHAR AS value_item_category,
-- json_extract(item.value, '$.item_category2')::VARCHAR AS value_item_category2,
-- json_extract(item.value, '$.item_category3')::VARCHAR AS value_item_category3,
-- json_extract(item.value, '$.item_category4')::VARCHAR AS value_item_category4,
-- json_extract(item.value, '$.item_category5')::VARCHAR AS value_item_category5,
json_extract(item.value, '$.item_id')::VARCHAR AS value_item_id,
-- json_extract(item.value, '$.item_list_id')::VARCHAR AS value_item_list_id,
json_extract(item.value, '$.item_list_index')::VARCHAR AS value_item_list_index,
json_extract(item.value, '$.item_list_name')::VARCHAR AS value_item_list_name,
json_extract(item.value, '$.item_name')::VARCHAR AS value_item_name,
CAST(json_extract(item.value, '$.item_refund') AS DOUBLE) AS value_item_refund,
CAST(json_extract(item.value, '$.item_refund_in_usd') AS DOUBLE) AS value_item_refund_in_usd,
CAST(json_extract(item.value, '$.item_revenue') AS DOUBLE) AS value_item_revenue,
CAST(json_extract(item.value, '$.item_revenue_in_usd') AS DOUBLE) AS value_item_revenue_in_usd,
json_extract(item.value, '$.item_variant')::VARCHAR AS value_item_variant,
-- json_extract(item.value, '$.location_id')::VARCHAR AS value_location_id,
CAST(json_extract(item.value, '$.price') AS DOUBLE) AS value_item_price,
CAST(json_extract(item.value, '$.price_in_usd') AS DOUBLE) AS value_item_price_in_usd,
-- json_extract(item.value, '$.promotion_id')::VARCHAR AS value_promotion_id,
json_extract(item.value, '$.promotion_name')::VARCHAR AS value_promotion_name,
-- CAST(json_extract(item.value, '$.quantity') AS INT) AS value_item_quantity

FROM obfuscated_sample_ecommerce AS main,
json_each(main.items) AS item
```
</details>

---

## Step 3: Create a Metrics View

With your data modeled, you can now define metrics and dimensions for analysis. In Rill, you have the option to create metrics via AI, which will send the schema and related information to OpenAI to build a basic metrics view. From there, you can make changes, add, or remove unneeded dimensions and measures.

<img src='/img/guides/ga4/create-metrics-with-ai.png' class='rounded-gif' />
<br />

Leverage Rill’s AI-powered features to quickly generate metrics views tailored to your business questions.

<img src='/img/guides/ga4/metrics-view.png' class='rounded-gif' />
<br />

---

## Step 4: Visualize Your Data

Finally, explore your GA4 data with interactive dashboards and visualizations. Here are a few example analyses you can perform in Rill:

- **Traffic Trends:** Track daily or weekly website sessions and identify spikes or drops in user activity.
- **User Segmentation:** Break down users by country, device type, or traffic source to understand your audience.
- **Ecommerce Performance:** Analyze purchase revenue, refund rates, and top-selling products over time.
- **Event Analysis:** Visualize key events (like sign-ups or checkouts) to optimize conversion funnels.

<img src='/img/guides/ga4/explore-dashboard.png' class='rounded-gif' />
<br />

Use Rill’s dashboard to analyze trends, segment users, and uncover insights from your GA4 events.

---
10 changes: 10 additions & 0 deletions docs/docs/guides/large-local-file.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: Working with a Large File Locally
sidebar_label: "Large Local File"
hide_table_of_contents: false
sidebar_position: 50

tags:
- Quickstart
- Tutorial
---
6 changes: 2 additions & 4 deletions docs/docs/guides/rill-clickhouse/3-r_ch_metrics-view.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
---
title: "3. Create Metrics View Dashboard in Rill"
sidebar_label: "3. Create Metrics View Dashboard in Rill"
title: "3. Create Metrics View in Rill"
sidebar_label: "3. Create Metrics View in Rill"
sidebar_position: 3
hide_table_of_contents: false
tags:
- OLAP:ClickHouse
- Tutorial
---

## Create the Metrics View.

If you noticed in the previous screenshot, we had a table called `uk_price_paid`. This is a dataset that is used in ClickHouse's Learning portal, so we thought it was fitting to go ahead and continue on this dataset.

:::note
Expand Down
3 changes: 0 additions & 3 deletions docs/docs/guides/rill-clickhouse/4-r_ch_dashboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ tags:
- Tutorial
---


### Create the explore dashboard

When you're ready, you can create the visualization on top of the metric layer. Let's select `Create Explore dashboard`. This will create a simple explore-dashboards/uk_price_paid_metrics_explore.yaml file that reads in all the dimensions and measures. For more information on the available key-pairs, please refer to the [reference documentation.](https://docs.rilldata.com/reference/project-files/explore-dashboards)

---
Expand Down
9 changes: 4 additions & 5 deletions docs/docs/guides/rill-clickhouse/5-r_ch_deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,20 @@ tags:
---
:::tip Rill Cloud Trial

If this is the first time you have deployed a project onto Rill Cloud, you will automatically start your [Rill Cloud Trial] () upon deployment of your Rill project. Your trial will last for 30 days. Please refer [here] () for more information on the details of your trial.
If this is the first time you have deployed a project onto Rill Cloud, you will automatically start your [Rill Cloud Trial](/other/FAQ#rill-cloud-trial) upon deployment of your Rill project. Your trial will last for 30 days. Please refer [here](/other/FAQ#rill-cloud-trial) for more information on the details of your trial.

:::

## Deploy via the UI!

Select the `Deploy to share` button in the top right corner of a dashboard.
Select the `Deploy` button in the top right corner of a dashboard.

<img src = '/img/tutorials/rill-basics/deploy-ui.gif' class='rounded-gif' />
<br />

Steps to deploy to Rill Cloud:
1. Select the `Deploy to share` button.
2. Select `continue` on the free trial [link to article of free trial explanation]
- If you have multiple organizations, please select Rill_Learn and `continue`.
1. Select the `Deploy` button.
2. Select `continue` on the [free trial UI](/other/account-management/billing#trial-plan).
3. Select `continue` on user invites.
4. You will be navigated to the /status page of your deployed project.

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/guides/rill-clickhouse/r_ch_ingest.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Ingesting Data into ClickHouse"
sidebar_label: "Ingesting Data Directly into ClickHouse"
sidebar_position: 4
sidebar_position: 40
hide_table_of_contents: false
tags:
- OLAP:ClickHouse
Expand Down
51 changes: 51 additions & 0 deletions docs/docs/guides/rill-motherduck/1-r_md_launch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
title: "1. Launch Rill Developer"
sidebar_label: "1. Launch Rill Developer"
sidebar_position: 3
hide_table_of_contents: false
tags:
- OLAP:ClickHouse
- Tutorial
---

:::note prerequisites
You will need to [install Rill](https://docs.rilldata.com/home/install).

```bash
curl https://rill.sh | sh
```

You need a MotherDuck token to connect to your MotherDuck database.
Check our MotherDuck's documentation on [how to generate an access token](https://motherduck.com/docs/key-tasks/authenticating-and-connecting-to-motherduck/authenticating-to-motherduck/#authentication-using-an-access-token).


:::
## Start Rill Developer

```yaml
rill start my-rill-motherduck
```

After running the command, Rill Developer should automatically open in your default browser. If not, you can access it via the following url:

```
localhost:9009
```

You should see the following webpage appear.

<img src = '/img/tutorials/rill-basics/new-rill-project.png' class='rounded-gif' />
<br />

Let's go ahead and select `Start with an empty project`.

<details>
<summary>Where am I in the terminal?</summary>

You can use the `pwd` command to see which directory in the terminal you are. <br />
If this is not where you'd like to make the directory use the `cd` command to change directories.

</details>



Loading