2019-11-19 07:30:42 +03:00
|
|
|
defmodule PlausibleWeb.Api.StatsController.BrowsersTest do
|
|
|
|
use PlausibleWeb.ConnCase
|
|
|
|
import Plausible.TestUtils
|
|
|
|
|
|
|
|
describe "GET /api/stats/:domain/browsers" do
|
|
|
|
setup [:create_user, :log_in, :create_site]
|
|
|
|
|
|
|
|
test "returns top browsers by new visitors", %{conn: conn, site: site} do
|
|
|
|
conn = get(conn, "/api/stats/#{site.domain}/browsers?period=day&date=2019-01-01")
|
|
|
|
|
|
|
|
assert json_response(conn, 200) == [
|
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" => "Chrome", "count" => 3, "percentage" => 75},
|
|
|
|
%{"name" => "Firefox", "count" => 1, "percentage" => 25}
|
2020-06-08 10:35:13 +03:00
|
|
|
]
|
2019-11-19 07:30:42 +03:00
|
|
|
end
|
|
|
|
end
|
2020-11-10 16:18:59 +03:00
|
|
|
|
|
|
|
describe "GET /api/stats/:domain/browser-versions" do
|
|
|
|
setup [:create_user, :log_in, :create_site]
|
|
|
|
|
|
|
|
test "returns top browser versions by unique visitors", %{conn: conn, site: site} do
|
|
|
|
filters = Jason.encode!(%{browser: "Chrome"})
|
2020-12-29 16:17:27 +03:00
|
|
|
|
|
|
|
conn =
|
|
|
|
get(
|
|
|
|
conn,
|
|
|
|
"/api/stats/#{site.domain}/browser-versions?period=day&date=2019-01-01&filters=#{
|
|
|
|
filters
|
|
|
|
}"
|
|
|
|
)
|
2020-11-10 16:18:59 +03:00
|
|
|
|
|
|
|
assert json_response(conn, 200) == [
|
2020-11-17 15:52:37 +03:00
|
|
|
%{"name" => "78.0", "count" => 1, "percentage" => 100}
|
2020-11-10 16:18:59 +03:00
|
|
|
]
|
|
|
|
end
|
|
|
|
end
|
2019-11-19 07:30:42 +03:00
|
|
|
end
|