Skip to content
Merged
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
49 changes: 49 additions & 0 deletions ecommerce-demo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,52 @@ For manual provision, follow this steps:
Make sure to not commit your changes to `http-client.private.env.json` to Git, as it holds your API Token.

To run the same in VS Code you can use `httpYac` extension.

# Analytics as code

[`workspaces/demo/analytics`](./workspaces/demo/analytics) holds the logical data model and the analytics of the `demo`
workspace as analytics as code (AaC) YAML, one file per object. It is the source of the sample data in the GoodData
organization UI ("Sample data" on the Home page). The UI build reads these files, not `ldm.json` and
`workspaceAnalytics.json`.

## Edit the demo

Use the [`gd` CLI](https://www.npmjs.com/package/@gooddata/code-cli) or the GoodData VS Code extension.

1. Install the CLI: `npm install -g @gooddata/code-cli`.
2. Create the data source and the workspace with the first requests of [upload.http](./upload.http), up to
"Create workspace".
3. In `workspaces/demo/analytics`, set the environment variables that [`gooddata.yaml`](./workspaces/demo/analytics/gooddata.yaml) reads:
```
export GOODDATA_HOST="<your host>"
export GOODDATA_API_TOKEN="<your API token>"
export GOODDATA_WORKSPACE_ID="<your workspace id>"
export GOODDATA_DATA_SOURCE_ID="gdc_ds_ecommerce_demo"
```
4. Run `gd deploy` to put the YAML into the workspace.
5. Change the workspace in the UI.
6. Run `gd clone` to write the workspace back to the YAML files.
7. Review the diff, and commit only the changes that you made on purpose.

Run `gd validate` before you commit. A deploy replaces the whole workspace, so an object that is missing from the YAML
is missing from the demo.

## Ship a change to the UI

The UI build does not read `master`. It reads this repository at a pinned commit, set by `DEMO_RESOURCES_GIT_REVISION`
in `modules/gdc-home-ui/module/scripts/fetch-demo-resources.sh` in the GoodData UI repository (`gdc-ui`, internal).
A merge to `master` does not change the demo in the UI.

1. Merge the change in this repository.
2. In `gdc-ui`, set `DEMO_RESOURCES_GIT_REVISION` to the merge commit, and open a pull request.

The build bundles every `.yaml` and `.yml` file in `workspaces/<workspace>/analytics`, except `gooddata.yaml`. The
build fails if a file has a YAML error, if a document has no `id` or `type`, if the UI cannot convert a document, or
if two objects of the same kind have the same `id`.

## Files that the UI does not read

- `workspaces/demo/ldm.json` and `workspaces/demo/workspaceAnalytics.json` are for the manual provision in
[upload.http](./upload.http). A change in the YAML does not update them.
- `workspaces/demo/ldm_v2.5.0.json` and `workspaces/demo/workspaceAnalytics_aio.json` are deprecated. Other GoodData
deployments still read them. Do not use them for new work.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# The attribute hierarchy is a user-defined list of attributes. This list determines the order
# in which subsequent attributes are revealed in a visualization during the drill-down process.
# Attributes lower in this hierarchy are automatically filtered based on the values selected from the higher-level attributes.
# Read more about attribute hierarchies:
# https://www.gooddata.com/docs/cloud/create-dashboards/drilling-in-dashboards/set-drill-down/

type: attribute_hierarchy
id: 445a32d8-2f88-4e90-a0fe-28098249d057

title: Customer Date Hierarchy

attributes:
- attribute/user_created_date.week
- attribute/user_created_date.day
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# The attribute hierarchy is a user-defined list of attributes. This list determines the order
# in which subsequent attributes are revealed in a visualization during the drill-down process.
# Attributes lower in this hierarchy are automatically filtered based on the values selected from the higher-level attributes.
# Read more about attribute hierarchies:
# https://www.gooddata.com/docs/cloud/create-dashboards/drilling-in-dashboards/set-drill-down/

type: attribute_hierarchy
id: 58c19264-1352-49e1-85bc-6802cf3b8dc3

title: Location Hierarchy

attributes:
- attribute/customer_country
- attribute/customer_state
- attribute/customer_city
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# The attribute hierarchy is a user-defined list of attributes. This list determines the order
# in which subsequent attributes are revealed in a visualization during the drill-down process.
# Attributes lower in this hierarchy are automatically filtered based on the values selected from the higher-level attributes.
# Read more about attribute hierarchies:
# https://www.gooddata.com/docs/cloud/create-dashboards/drilling-in-dashboards/set-drill-down/

type: attribute_hierarchy
id: ad14f0ed-9ba5-44ff-bd35-46ac2775a7ea

title: Product attribute hierarchy

attributes:
- attribute/product_category
- attribute/product_brand
- attribute/product_id
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# The attribute hierarchy is a user-defined list of attributes. This list determines the order
# in which subsequent attributes are revealed in a visualization during the drill-down process.
# Attributes lower in this hierarchy are automatically filtered based on the values selected from the higher-level attributes.
# Read more about attribute hierarchies:
# https://www.gooddata.com/docs/cloud/create-dashboards/drilling-in-dashboards/set-drill-down/

type: attribute_hierarchy
id: 72a9b29c-d982-4a9d-b226-ebcd060801dc

title: Untitled attribute hierarchy

attributes:
- attribute/date.weekOfYear
- attribute/date.day
- attribute/date.hour
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# The attribute hierarchy is a user-defined list of attributes. This list determines the order
# in which subsequent attributes are revealed in a visualization during the drill-down process.
# Attributes lower in this hierarchy are automatically filtered based on the values selected from the higher-level attributes.
# Read more about attribute hierarchies:
# https://www.gooddata.com/docs/cloud/create-dashboards/drilling-in-dashboards/set-drill-down/

type: attribute_hierarchy
id: c26bc638-4c0e-4729-90ee-142530f882d1

title: Untitled attribute hierarchy

attributes:
- attribute/date.week
- attribute/date.day
190 changes: 190 additions & 0 deletions ecommerce-demo/workspaces/demo/analytics/dashboards/customers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
# A dashboard is a collection of visualizations that are organized into sections.
# Because they allow filtering and other adjustments, they function as a dynamic presentation layer for your data analytics.
# Read more about dashboards:
# https://www.gooddata.com/docs/cloud/create-dashboards/concepts/dashboard/

type: dashboard
id: customers

version: "2"

title: 3. Customers
description: Dashboard focused on customer analytics, including repeat versus one-time customers, returning customers, average sales per customer, and retention rate. Provides breakdown by country and state, location maps, top and bottom customers by revenue, customer lifetime value (CLV) versus purchase frequency, and activity by hour. Suitable for customers overview, customer analytics, and customer insights.

cross_filtering: false

sections:
- widgets:
- id: widget_customers_multiple_orders
visualization: customers_with_multiple_orders
title: Customers with Multiple Orders
columns: 3
rows: 11
date: date
interactions:
- click_on: d5c013a351ca42318c1d9d81a81d32ff
open_visualization: order_details
- id: widget_returning_customers
visualization: returning_customers
title: Returning Customers
columns: 3
rows: 10
date: date
interactions:
- click_on: 1df9a9af3c734b5da9f719b62d1b06c3
open_visualization: customer_activity_over_time
- id: widget_avg_sales_per_customer
visualization: average_sales_per_customer
title: Average Sales per Customer
columns: 3
rows: 10
date: date
interactions:
- click_on: 5d0ce2b953c9471199c8293770cc19db
open_visualization: customer_orders_and_sales_details
- id: widget_customer_retention_rate
visualization: customer_retention_rate
title: Customer Retention Rate
columns: 3
rows: 11
date: date
interactions:
- click_on: 0b28ab87a0b947ba840501b2874dbde4
open_visualization: customer_retention_rate_forecast
- title: Customer Breakdown
description: Visualize where customers are located and how their orders and product preferences vary by region.
widgets:
- id: widget_customers_location_tabs
visualizations:
- id: widget_customers_by_country_state_tab
visualization: customers_by_country_and_state
title: Customers by Country and State
- id: widget_orders_by_location_tab
visualization: orders_by_location_area_map
title: Orders by Location (Area map)
date: date
columns: 6
rows: 34
- container: container_customer_breakdown
columns: 6
rows: 34
layout_direction: column
enable_section_headers: false
sections:
- widgets:
- id: widget_top_5_states
visualization: top_5_states_by_number_of_orders
title: Top 5 States by Number of Orders
columns: 6
rows: 16
date: date
ignored_cross_filtering: true
- container: container_product_preferences
columns: 6
rows: 18
layout_direction: row
enable_section_headers: false
sections:
- widgets:
- id: widget_product_preferences
visualization: product_preferences_by_customers
title: Product Preferences by Customers
columns: 3
rows: 18
date: date
- id: widget_orders_by_category
visualization: orders_by_product_category
title: Orders by Product Category
columns: 3
rows: 18
date: date
- title: Customer Retention Trends
description: Tracks customer mix over time, showing how many are first-time buyers versus repeat customers.
widgets:
- id: widget_customers_breakdown
visualization: customers_breakdown
title: Customers Breakdown
columns: 4
rows: 20
date: date
- id: widget_customer_activity_over_time
visualization: customer_activity_over_time
title: Customer Activity Over Time
columns: 8
rows: 20
date: date
zoom_data: true
- widgets:
- container: container_customer_preferences
columns: 6
rows: 45
layout_direction: column
enable_section_headers: true
sections:
- title: Customer Preferences
description: Analyze customer behavior by segment, comparing lifetime value and purchase frequency to identify loyal, high-value, and growth customers.
widgets:
- id: widget_customer_lifetime_value
visualization: customer_lifetime_value_clv_vs_purchase
title: Customer Lifetime Value (CLV) vs. Purchase Frequency
columns: 6
rows: 21
date: date
- id: widget_customer_activity_by_hour
visualization: customer_activity_by_hour
title: Customer Activity by Hour
columns: 6
rows: 22
date: date
- container: container_customer_revenue_rankings
columns: 6
rows: 45
layout_direction: column
enable_section_headers: true
sections:
- title: Customer Revenue Rankings
description: Ranks customers by revenue contribution.
widgets:
- id: widget_top_bottom_customers_tabs
visualizations:
- id: widget_top_10_customers_tab
visualization: top_10_customers_by_revenue
title: Top 10 Customers by Revenue
date: date
- id: widget_top_10_details_tab
visualization: top_10_customers_by_revenue_details
title: Top 10 Customers by Revenue (Details)
date: date
columns: 6
rows: 22
- id: widget_bottom_10_tabs
visualizations:
- id: widget_bottom_10_details_tab
visualization: bottom_10_customers_by_revenue_details
title: Bottom 10 Customers by Revenue (Details)
date: date
- id: widget_bottom_10_revenue_tab
visualization: bottom_10_customers_by_revenue
title: Bottom 10 Customers by Revenue
date: date
columns: 6
rows: 22

filters:
date_quarter:
type: date_filter
granularity: QUARTER
from: -1
to: -1
customer_country_filter:
type: attribute_filter
using: label/customer_country
customer_state_filter:
type: attribute_filter
using: label/customer_state
parents:
- customer_country_filter

permissions:
VIEW:
all: true
Loading
Loading