2020-05-07 14:28:41 +03:00
|
|
|
defmodule Plausible.Test.ClickhouseSetup do
|
2020-05-25 14:52:20 +03:00
|
|
|
@conversion_1_session_id 123
|
|
|
|
@conversion_2_session_id 234
|
|
|
|
|
2020-09-17 16:36:01 +03:00
|
|
|
def run() do
|
2020-05-18 12:44:52 +03:00
|
|
|
Plausible.TestUtils.create_events([
|
2020-06-08 10:35:13 +03:00
|
|
|
%{
|
|
|
|
name: "pageview",
|
|
|
|
domain: "test-site.com",
|
|
|
|
pathname: "/",
|
|
|
|
country_code: "EE",
|
|
|
|
browser: "Chrome",
|
2020-11-10 16:18:59 +03:00
|
|
|
browser_version: "78.0",
|
2020-06-08 10:35:13 +03:00
|
|
|
operating_system: "Mac",
|
2020-11-10 16:18:59 +03:00
|
|
|
operating_system_version: "10.15",
|
2020-06-08 10:35:13 +03:00
|
|
|
screen_size: "Desktop",
|
|
|
|
referrer_source: "10words",
|
|
|
|
referrer: "10words.com/page1",
|
2020-11-17 15:52:37 +03:00
|
|
|
timestamp: ~N[2019-01-01 00:00:00],
|
2020-12-29 16:17:27 +03:00
|
|
|
session_id: @conversion_1_session_id
|
2020-06-08 10:35:13 +03:00
|
|
|
},
|
|
|
|
%{
|
|
|
|
name: "pageview",
|
|
|
|
domain: "test-site.com",
|
|
|
|
pathname: "/",
|
|
|
|
country_code: "EE",
|
|
|
|
browser: "Chrome",
|
2020-11-10 16:18:59 +03:00
|
|
|
browser_version: "78.0",
|
2020-06-08 10:35:13 +03:00
|
|
|
operating_system: "Mac",
|
2020-11-10 16:18:59 +03:00
|
|
|
operating_system_version: "10.15",
|
2020-06-08 10:35:13 +03:00
|
|
|
screen_size: "Desktop",
|
|
|
|
referrer_source: "10words",
|
|
|
|
referrer: "10words.com/page2",
|
|
|
|
timestamp: ~N[2019-01-01 00:00:00]
|
|
|
|
},
|
Adds entry and exit pages to Top Pages module (#712)
* Initial Pass
* Adds support for page visits counting by referrer
* Includes goal selection in entry and exit computation
* Adds goal-based entry and exit page stats, formatting, code cleanup
* Changelog
* Format
* Exit rate, visit duration, updated tests
* I keep forgetting to format :/
* Tests, last time
* Fixes double counting, exit rate >100%, relevant tests
* Fixes exit pages on filter and goal states
* Adds entry and exit filters, fixes various bugs
* Fixes discussed issues
* Format
* Fixes impossible case in tests
Originally, there were only 2 pageviews for `test-site.com`,`/` on `2019-01-01`, but that doesn't make sense when there were 3 sessions that exited on the same site/date.
* Format
* Removes boolean function parameter in favor of separate function
* Adds support for queries that use `page` filter as `entry-page`
* Format
* Makes loader/title interaction in sources report consistent
2021-02-26 12:02:37 +03:00
|
|
|
%{
|
|
|
|
name: "pageview",
|
|
|
|
domain: "test-site.com",
|
|
|
|
pathname: "/",
|
|
|
|
country_code: "US",
|
|
|
|
browser: "Chrome",
|
|
|
|
browser_version: "79.0",
|
|
|
|
operating_system: "Mac",
|
|
|
|
operating_system_version: "10.16",
|
|
|
|
screen_size: "Laptop",
|
|
|
|
referrer_source: "",
|
|
|
|
referrer: "",
|
|
|
|
timestamp: ~N[2019-01-01 00:00:00]
|
|
|
|
},
|
2020-06-08 10:35:13 +03:00
|
|
|
%{
|
|
|
|
name: "pageview",
|
|
|
|
domain: "test-site.com",
|
|
|
|
pathname: "/contact",
|
|
|
|
country_code: "GB",
|
|
|
|
browser: "Firefox",
|
|
|
|
operating_system: "Android",
|
|
|
|
screen_size: "Mobile",
|
|
|
|
referrer_source: "Bing",
|
|
|
|
timestamp: ~N[2019-01-01 00:00:00]
|
|
|
|
},
|
2020-05-18 12:44:52 +03:00
|
|
|
%{name: "pageview", domain: "test-site.com", timestamp: ~N[2019-01-31 00:00:00]},
|
2020-06-08 10:35:13 +03:00
|
|
|
%{
|
|
|
|
name: "Signup",
|
|
|
|
domain: "test-site.com",
|
|
|
|
session_id: @conversion_1_session_id,
|
2020-10-28 12:09:04 +03:00
|
|
|
timestamp: ~N[2019-01-01 01:00:00],
|
|
|
|
"meta.key": ["variant"],
|
|
|
|
"meta.value": ["A"]
|
2020-06-08 10:35:13 +03:00
|
|
|
},
|
|
|
|
%{
|
|
|
|
name: "Signup",
|
|
|
|
domain: "test-site.com",
|
|
|
|
session_id: @conversion_1_session_id,
|
2020-10-28 12:09:04 +03:00
|
|
|
timestamp: ~N[2019-01-01 02:00:00],
|
|
|
|
"meta.key": ["variant"],
|
|
|
|
"meta.value": ["B"]
|
2020-06-08 10:35:13 +03:00
|
|
|
},
|
|
|
|
%{
|
|
|
|
name: "Signup",
|
|
|
|
domain: "test-site.com",
|
|
|
|
session_id: @conversion_2_session_id,
|
2020-10-28 12:09:04 +03:00
|
|
|
timestamp: ~N[2019-01-01 02:00:00],
|
|
|
|
"meta.key": ["variant"],
|
|
|
|
"meta.value": ["B"]
|
2020-06-08 10:35:13 +03:00
|
|
|
},
|
|
|
|
%{
|
|
|
|
name: "pageview",
|
|
|
|
pathname: "/register",
|
|
|
|
domain: "test-site.com",
|
|
|
|
session_id: @conversion_1_session_id,
|
|
|
|
timestamp: ~N[2019-01-01 23:00:00]
|
|
|
|
},
|
|
|
|
%{
|
|
|
|
name: "pageview",
|
|
|
|
pathname: "/register",
|
|
|
|
domain: "test-site.com",
|
|
|
|
session_id: @conversion_2_session_id,
|
|
|
|
timestamp: ~N[2019-01-01 23:00:00]
|
|
|
|
},
|
|
|
|
%{
|
|
|
|
name: "pageview",
|
|
|
|
pathname: "/irrelevant",
|
|
|
|
domain: "test-site.com",
|
|
|
|
session_id: @conversion_1_session_id,
|
2021-05-18 15:14:33 +03:00
|
|
|
timestamp: ~N[2019-01-01 23:00:01]
|
2020-06-08 10:35:13 +03:00
|
|
|
},
|
|
|
|
%{
|
|
|
|
name: "pageview",
|
|
|
|
domain: "test-site.com",
|
|
|
|
referrer_source: "Google",
|
|
|
|
timestamp: ~N[2019-02-01 01:00:00]
|
|
|
|
},
|
|
|
|
%{
|
|
|
|
name: "pageview",
|
|
|
|
domain: "test-site.com",
|
|
|
|
referrer_source: "Google",
|
|
|
|
timestamp: ~N[2019-02-01 02:00:00]
|
|
|
|
},
|
|
|
|
%{
|
|
|
|
name: "pageview",
|
|
|
|
domain: "test-site.com",
|
|
|
|
referrer: "t.co/some-link",
|
|
|
|
referrer_source: "Twitter",
|
|
|
|
timestamp: ~N[2019-03-01 01:00:00]
|
|
|
|
},
|
|
|
|
%{
|
|
|
|
name: "pageview",
|
|
|
|
domain: "test-site.com",
|
|
|
|
referrer: "t.co/some-link",
|
|
|
|
referrer_source: "Twitter",
|
|
|
|
timestamp: ~N[2019-03-01 01:00:00]
|
|
|
|
},
|
|
|
|
%{
|
|
|
|
name: "pageview",
|
|
|
|
domain: "test-site.com",
|
|
|
|
referrer: "t.co/nonexistent-link",
|
|
|
|
referrer_source: "Twitter",
|
|
|
|
timestamp: ~N[2019-03-01 02:00:00]
|
|
|
|
},
|
2020-05-18 12:44:52 +03:00
|
|
|
%{name: "pageview", domain: "test-site.com"},
|
2020-06-08 10:35:13 +03:00
|
|
|
%{
|
|
|
|
name: "pageview",
|
|
|
|
domain: "test-site.com",
|
|
|
|
timestamp: Timex.now() |> Timex.shift(minutes: -3)
|
|
|
|
},
|
|
|
|
%{
|
|
|
|
name: "pageview",
|
|
|
|
domain: "test-site.com",
|
|
|
|
timestamp: Timex.now() |> Timex.shift(minutes: -6)
|
|
|
|
},
|
2020-05-18 12:44:52 +03:00
|
|
|
%{name: "pageview", domain: "tz-test.com", timestamp: ~N[2019-01-01 00:00:00]},
|
2020-06-05 16:14:17 +03:00
|
|
|
%{name: "pageview", domain: "public-site.io"},
|
2020-06-08 10:35:13 +03:00
|
|
|
%{
|
|
|
|
name: "pageview",
|
|
|
|
domain: "fetch-tweets-test.com",
|
|
|
|
referrer: "t.co/a-link",
|
|
|
|
referrer_source: "Twitter"
|
|
|
|
},
|
|
|
|
%{
|
|
|
|
name: "pageview",
|
|
|
|
domain: "fetch-tweets-test.com",
|
|
|
|
referrer: "t.co/b-link",
|
|
|
|
referrer_source: "Twitter",
|
|
|
|
timestamp: Timex.now() |> Timex.shift(days: -5)
|
2021-03-02 15:53:03 +03:00
|
|
|
},
|
|
|
|
%{
|
|
|
|
name: "pageview",
|
|
|
|
pathname: "/register",
|
|
|
|
domain: "test-site.com",
|
|
|
|
timestamp: ~N[2019-07-01 23:00:00]
|
|
|
|
},
|
|
|
|
%{
|
|
|
|
name: "pageview",
|
|
|
|
pathname: "/signup/new",
|
|
|
|
domain: "test-site.com",
|
|
|
|
timestamp: ~N[2019-07-01 23:00:00]
|
|
|
|
},
|
|
|
|
%{
|
|
|
|
name: "pageview",
|
|
|
|
pathname: "/billing/success",
|
|
|
|
domain: "test-site.com",
|
|
|
|
timestamp: ~N[2019-07-01 23:00:00]
|
|
|
|
},
|
|
|
|
%{
|
|
|
|
name: "pageview",
|
|
|
|
pathname: "/",
|
|
|
|
domain: "test-site.com",
|
|
|
|
timestamp: ~N[2019-07-01 23:00:00]
|
|
|
|
},
|
|
|
|
%{
|
|
|
|
name: "pageview",
|
|
|
|
pathname: "/reg",
|
|
|
|
domain: "test-site.com",
|
|
|
|
timestamp: ~N[2019-07-01 23:00:00]
|
|
|
|
},
|
|
|
|
%{
|
|
|
|
name: "pageview",
|
|
|
|
pathname: "/signup/new/2",
|
|
|
|
domain: "test-site.com",
|
|
|
|
timestamp: ~N[2019-07-01 23:00:00]
|
|
|
|
},
|
|
|
|
%{
|
|
|
|
name: "pageview",
|
|
|
|
pathname: "/signup/new/3",
|
|
|
|
domain: "test-site.com",
|
|
|
|
timestamp: ~N[2019-07-01 23:00:00]
|
|
|
|
},
|
|
|
|
%{
|
|
|
|
name: "pageview",
|
|
|
|
pathname: "/billing/upgrade/success",
|
|
|
|
domain: "test-site.com",
|
|
|
|
timestamp: ~N[2019-07-01 23:00:00]
|
2020-06-08 10:35:13 +03:00
|
|
|
}
|
2020-05-18 12:44:52 +03:00
|
|
|
])
|
|
|
|
|
|
|
|
Plausible.TestUtils.create_sessions([
|
2020-06-08 10:35:13 +03:00
|
|
|
%{
|
|
|
|
domain: "test-site.com",
|
|
|
|
entry_page: "/",
|
|
|
|
exit_page: "/",
|
|
|
|
referrer_source: "10words",
|
|
|
|
referrer: "10words.com/page1",
|
2020-09-28 11:29:24 +03:00
|
|
|
utm_medium: "listing",
|
2020-10-13 12:03:42 +03:00
|
|
|
country_code: "US",
|
|
|
|
screen_size: "Desktop",
|
|
|
|
browser: "Chrome",
|
2020-11-17 15:52:37 +03:00
|
|
|
browser_version: "78.0",
|
2020-10-13 12:03:42 +03:00
|
|
|
operating_system: "Mac",
|
2020-11-17 15:52:37 +03:00
|
|
|
operating_system_version: "10.15",
|
2020-06-08 10:35:13 +03:00
|
|
|
session_id: @conversion_1_session_id,
|
|
|
|
is_bounce: true,
|
2020-07-17 11:09:54 +03:00
|
|
|
duration: 100,
|
2020-08-03 15:56:14 +03:00
|
|
|
start: ~N[2019-01-01 02:00:00],
|
|
|
|
timestamp: ~N[2019-01-01 02:00:00]
|
2020-06-08 10:35:13 +03:00
|
|
|
},
|
|
|
|
%{
|
|
|
|
domain: "test-site.com",
|
|
|
|
entry_page: "/",
|
|
|
|
exit_page: "/",
|
|
|
|
referrer_source: "10words",
|
|
|
|
referrer: "10words.com/page1",
|
2020-09-28 11:29:24 +03:00
|
|
|
utm_medium: "listing",
|
2020-06-08 10:35:13 +03:00
|
|
|
session_id: @conversion_2_session_id,
|
|
|
|
is_bounce: false,
|
2020-07-17 11:09:54 +03:00
|
|
|
duration: 0,
|
2020-08-03 15:56:14 +03:00
|
|
|
start: ~N[2019-01-01 02:00:00],
|
|
|
|
timestamp: ~N[2019-01-01 02:00:00]
|
2020-06-17 11:18:23 +03:00
|
|
|
},
|
|
|
|
%{
|
|
|
|
domain: "test-site.com",
|
|
|
|
entry_page: "/",
|
|
|
|
exit_page: "/",
|
|
|
|
referrer_source: "Bing",
|
|
|
|
referrer: "",
|
2020-09-28 11:29:24 +03:00
|
|
|
utm_medium: "search",
|
2020-06-17 11:18:23 +03:00
|
|
|
is_bounce: false,
|
2020-07-17 11:09:54 +03:00
|
|
|
duration: 100,
|
2020-08-03 15:56:14 +03:00
|
|
|
start: ~N[2019-01-01 03:00:00],
|
|
|
|
timestamp: ~N[2019-01-01 03:00:00]
|
2020-07-14 16:52:26 +03:00
|
|
|
},
|
|
|
|
%{
|
|
|
|
domain: "test-site.com",
|
|
|
|
entry_page: "/",
|
|
|
|
exit_page: "/",
|
|
|
|
referrer_source: "Google",
|
|
|
|
referrer: "",
|
|
|
|
is_bounce: false,
|
|
|
|
start: ~N[2019-02-01 01:00:00],
|
|
|
|
timestamp: ~N[2019-02-01 01:00:00]
|
|
|
|
},
|
|
|
|
%{
|
|
|
|
domain: "test-site.com",
|
|
|
|
entry_page: "/",
|
|
|
|
exit_page: "/",
|
|
|
|
referrer_source: "Google",
|
|
|
|
referrer: "",
|
|
|
|
is_bounce: false,
|
|
|
|
start: ~N[2019-02-01 02:00:00],
|
|
|
|
timestamp: ~N[2019-02-01 02:00:00]
|
|
|
|
},
|
|
|
|
%{
|
|
|
|
domain: "test-site.com",
|
|
|
|
entry_page: "/",
|
|
|
|
exit_page: "/",
|
|
|
|
referrer: "t.co/some-link",
|
|
|
|
referrer_source: "Twitter",
|
|
|
|
start: ~N[2019-03-01 01:00:00],
|
|
|
|
timestamp: ~N[2019-03-01 01:00:00]
|
|
|
|
},
|
|
|
|
%{
|
|
|
|
domain: "test-site.com",
|
|
|
|
entry_page: "/",
|
|
|
|
exit_page: "/",
|
|
|
|
referrer: "t.co/some-link",
|
|
|
|
referrer_source: "Twitter",
|
|
|
|
start: ~N[2019-03-01 01:00:00],
|
|
|
|
timestamp: ~N[2019-03-01 01:00:00]
|
|
|
|
},
|
|
|
|
%{
|
|
|
|
domain: "test-site.com",
|
|
|
|
entry_page: "/",
|
|
|
|
exit_page: "/",
|
|
|
|
referrer: "t.co/nonexistent-link",
|
|
|
|
referrer_source: "Twitter",
|
|
|
|
start: ~N[2019-03-01 02:00:00],
|
|
|
|
timestamp: ~N[2019-03-01 02:00:00]
|
2020-07-30 11:18:28 +03:00
|
|
|
},
|
|
|
|
%{
|
|
|
|
domain: "test-site.com",
|
|
|
|
entry_page: "/",
|
|
|
|
exit_page: "/",
|
|
|
|
referrer_source: "Bing",
|
|
|
|
referrer: "bing.com",
|
|
|
|
start: Timex.now() |> Timex.shift(minutes: -1),
|
|
|
|
timestamp: Timex.now() |> Timex.shift(minutes: -1)
|
|
|
|
},
|
|
|
|
%{
|
|
|
|
domain: "test-site.com",
|
|
|
|
entry_page: "/",
|
|
|
|
exit_page: "/exit",
|
|
|
|
referrer_source: "10words",
|
|
|
|
referrer: "10words.com",
|
|
|
|
start: Timex.now() |> Timex.shift(minutes: -2),
|
|
|
|
timestamp: Timex.now() |> Timex.shift(minutes: -2)
|
|
|
|
},
|
|
|
|
%{
|
|
|
|
domain: "test-site.com",
|
|
|
|
entry_page: "/",
|
|
|
|
exit_page: "/exit",
|
|
|
|
referrer_source: "10words",
|
|
|
|
referrer: "10words.com",
|
|
|
|
start: Timex.now() |> Timex.shift(minutes: -3),
|
|
|
|
timestamp: Timex.now() |> Timex.shift(minutes: -3)
|
2020-07-21 09:58:00 +03:00
|
|
|
}
|
2020-05-18 12:44:52 +03:00
|
|
|
])
|
2020-05-07 14:28:41 +03:00
|
|
|
end
|
|
|
|
end
|