Skip to content

Add dynamic funnel generation

Max Woolf requested to merge funnel-analysis into main

Adds support for a dynamic schema to display funnels.

How to test

  • Make sure your GDK is running origin/funnels-analysis-poc
  • Ensure that the .env file for Cube has the GITLAB_BASE_URI set.
  • Define a funnel as defined in the docs: gitlab-org/gitlab!108712 (diffs) (Or you can use this one:)
name: completed_purchase
seconds_to_convert: 3600
steps:
  - name: view_page_1
    target: '/page1.html'
    action: 'pageview'
  - name: view_page_2
    target: '/page2.html'
    action: 'pageview'
  - name: view_page_3
    target: '/page3.html'
    action: 'pageview'
  - name: view_page_4
    target: '/page4.html'
    action: 'pageview'
  - name: view_page_5
    target: '/page5.html'
    action: 'pageview'
  - name: view_page_6
    target: '/page6.html'
    action: 'pageview'
  - name: view_page_7
    target: '/page7.html'
    action: 'pageview'
  • Make sure to remove any .gitkeep files from the newly created /funnels folder
  • Execute the funnel data generation script: bundle exec ruby utils/funnel_generator.rb (or ruby utils/funnel_generator.rb if bundler isn't set up) and import the generated CSV in to clickhouse.
    • You can import the CSV through a UI such as the JetBrains database UI or you can use the Clickhouse Client cat tmp_data.csv | clickhouse-client -q 'INSERT INTO PROJECT_DB.jitsu FORMAT CSV' --user USERNAME --password PASSWORD
  • Run the appropriate cube proxy query:
{ "query": {
  "measures": [
    "completed_purchase.count"
  ],
  "order": {
    "completed_purchase.count": "desc"
  },
  "filters": [
    {
      "member": "completed_purchase.date",
      "operator": "beforeDate",
      "values": [
        "2023-02-01"
      ]
    }
  ],
  "dimensions": [
    "completed_purchase.step"
  ]
} }
Edited by Robert Hunt

Merge request reports