Compare commits

..

7 Commits

Author SHA1 Message Date
Adrian Gruntkowski a7603c9e49
Improve import procedure to ensure no time range overlaps (#3970)
* Always scope import ID by site as well

* Do not schedule new import job if there are any site imports in progress

* Disable import buttons when any import is in progress

* Simplify `schedule_job/4` (h/t @RobertJoonas)
3 years ago
Adrian Gruntkowski cffff0340c
Handle Google API timeouts gracefully during imports (#3975) 3 years ago
Adrian Gruntkowski 33eed9d7db
Delete imports which have no stats (#3972) 3 years ago
Marko Saric e5b7f1afd0
Changing the copy of the locked screen (#3967)
changing the copy here as I think that in some situations the "we're still counting stats" message is now shown even to those dashboards where we've stopped counting stats so best to avoid that
3 years ago
Uku Taht f966419a4a
Update ua_inspector (#3957)
Co-authored-by: hq1 <hq@mtod.org>
3 years ago
hq1 f9f0407d68
Remove `experimtnal_hostname_filter` and keep it on by default (#3973)
* Remove `experimental_hostname_filter` and keep it on by default

* Catch up with changes done via e5b56dbe6
3 years ago
RobertJoonas e5b56dbe62
Refactor VisitorGraph (#3936)
* Give a more semantic name to a function

* Make the LineGraph component thinner

* Move LineGraph into a separate file

* Move interval logic into interval-picker.js

This commit also fixes a bug where the interval name displayed inside
the picker component flickers the default interval when the graph is
loading.

The problem was that we were counting on graphData for returning us the
current interval: `let currentInterval = graphData?.interval`

We should always know the default interval before making the main-graph
request. Sending graphData to IntervalPicker component does not make
sense anyway.

* extract data fetching functions out of VisitorGraph component

* Return graph_metric key from Top Stats API

This commit introduces no behavioral changes - only starts returning an
additional field, allowing us to avoid the following logic in React:

1. Finding the metric names, given a stat display name. E.g.
   `Unique visitors (last 30 min) -> visitors`

2. Checking if a metric is graphable or not

* Move metric state into localStorage

This commit gets rid of the internal `metric` state in the VisitorGraph
component and starts using localStorage for that instead.

This commit also chains the main-graph request into the top-stats request
callback - meaning that we'll always fetch new graph data after top stats
are updated. And we do it all in a single function.

Doing so simplifies the loading state significantly, and also helps to
make it clear, that at all times, existing top stats are required before
we can fetch the graph. That's because the metric is determined by which
Top stats are returned (for example, we can't be sure whether revenue
metrics will be returned or not).

* Make sure graph tooltip says "Converted Visitors"

* Extract a StatsExport function component

Again, instead of relying on `graphData?.interval` we can read it from
localStorage, or default to the largest interval available. The export
should not be dependant on the graph.

* Extract SamplingNotice function component

* Extract WithImportedSwitch function component

* Stop "lazy-loading" the graph and top stats

Since the container is always on top on the page, it will be visible on
the first render in any case - no matter the screen size.

* Turn VisitorGraph into a function component

* Display empty container until everything has loaded

* Do not display loading spinner on realtime ticks

* Turn Top Stats into a fn component

* fetch top stats and graph async

* Make sure revenue metrics can remain on the graph

* Add an extra check to canMetricBeGraphed

* fix typo

* remove redundant double negation
3 years ago

@ -29,7 +29,8 @@ if (container) {
embedded: container.dataset.embedded,
background: container.dataset.background,
isDbip: container.dataset.isDbip === 'true',
flags: JSON.parse(container.dataset.flags)
flags: JSON.parse(container.dataset.flags),
validIntervalsByPeriod: JSON.parse(container.dataset.validIntervalsByPeriod)
}
const loggedIn = container.dataset.loggedIn === 'true'

@ -44,7 +44,6 @@ export function serializeQuery(query, extraQuery = []) {
if (query.to) { queryObj.to = formatISO(query.to) }
if (query.filters) { queryObj.filters = serializeFilters(query.filters) }
if (query.experimental_session_count) { queryObj.experimental_session_count = query.experimental_session_count }
if (query.experimental_hostname_filter) { queryObj.experimental_hostname_filter = query.experimental_hostname_filter }
if (query.with_imported) { queryObj.with_imported = query.with_imported }
if (SHARED_LINK_AUTH) { queryObj.auth = SHARED_LINK_AUTH }

@ -40,7 +40,6 @@ export function parseQuery(querystring, site) {
match_day_of_week: matchDayOfWeek == 'true',
with_imported: q.get('with_imported') ? q.get('with_imported') === 'true' : true,
experimental_session_count: q.get('experimental_session_count'),
experimental_hostname_filter: q.get('experimental_hostname_filter'),
filters: {
'goal': q.get('goal'),
'props': JSON.parse(q.get('props')),

@ -1,4 +1,42 @@
import numberFormatter, {durationFormatter} from '../../util/number-formatter'
import { parsePrefix } from '../../util/filters'
export function getGraphableMetrics(query, site) {
const isRealtime = query.period === 'realtime'
const goalFilter = query.filters.goal
const pageFilter = query.filters.page
if (isRealtime && goalFilter) {
return ["visitors"]
} else if (isRealtime) {
return ["visitors", "pageviews"]
} else if (goalFilter && canGraphRevenueMetrics(goalFilter, site)) {
return ["visitors", "events", "average_revenue", "total_revenue", "conversion_rate"]
} else if (goalFilter) {
return ["visitors", "events", "conversion_rate"]
} else if (pageFilter) {
return ["visitors", "visits", "pageviews", "bounce_rate", "time_on_page"]
} else {
return ["visitors", "visits", "pageviews", "views_per_visit", "bounce_rate", "visit_duration"]
}
}
// Revenue metrics can only be graphed if:
// * The query is filtered by at least one revenue goal
// * All revenue goals in filter have the same currency
function canGraphRevenueMetrics(goalFilter, site) {
const goalsInFilter = parsePrefix(goalFilter).values
const revenueGoalsInFilter = site.revenueGoals.filter((rg) => {
return goalsInFilter.includes(rg.event_name)
})
const singleCurrency = revenueGoalsInFilter.every((rg) => {
return rg.currency === revenueGoalsInFilter[0].currency
})
return revenueGoalsInFilter.length > 0 && singleCurrency
}
export const METRIC_LABELS = {
'visitors': 'Visitors',

@ -2,7 +2,9 @@ import { Menu, Transition } from '@headlessui/react';
import { ChevronDownIcon } from '@heroicons/react/20/solid'
import React, { Fragment, useCallback, useEffect } from 'react';
import classNames from 'classnames'
import * as storage from '../../util/storage'
import { isKeyPressed } from '../../keybinding.js'
import { monthsBetweenDates } from '../../util/date.js'
const INTERVAL_LABELS = {
'minute': 'Minutes',
@ -12,6 +14,22 @@ const INTERVAL_LABELS = {
'month': 'Months'
}
function validIntervals(site, query) {
if (query.period === "custom" && monthsBetweenDates(query.from, query.to) > 12) {
return ["week", "month"]
} else {
return site.validIntervalsByPeriod[query.period]
}
}
function getStoredInterval(period, domain) {
return storage.getItem(`interval__${period}__${domain}`)
}
function storeInterval(period, domain, interval) {
storage.setItem(`interval__${period}__${domain}`, interval)
}
function subscribeKeybinding(element) {
const handleKeyPress = useCallback((event) => {
if (isKeyPressed(event, "i")) element.current?.click()
@ -23,21 +41,41 @@ function subscribeKeybinding(element) {
}, [handleKeyPress])
}
export function IntervalPicker({ query, currentInterval, options, onIntervalUpdate }) {
if (query.period == 'realtime') return null
export const getCurrentInterval = function(site, query) {
const options = validIntervals(site, query)
const storedInterval = getStoredInterval(query.period, site.domain)
const defaultInterval = [...options].pop()
if (storedInterval && options.includes(storedInterval)) {
return storedInterval
} else {
return defaultInterval
}
}
export function IntervalPicker({ query, site, onIntervalUpdate }) {
if (query.period == 'realtime') return null
const menuElement = React.useRef(null)
const options = validIntervals(site, query)
const currentInterval = getCurrentInterval(site, query)
subscribeKeybinding(menuElement)
function updateInterval(interval) {
storeInterval(query.period, site.domain, interval)
onIntervalUpdate(interval)
}
function renderDropdownItem(option) {
return (
<Menu.Item onClick={() => onIntervalUpdate(option)} key={option} disabled={option == currentInterval}>
<Menu.Item onClick={() => updateInterval(option)} key={option} disabled={option == currentInterval}>
{({ active }) => (
<span className={classNames({
'bg-gray-100 dark:bg-gray-900 text-gray-900 dark:text-gray-200 cursor-pointer': active,
'text-gray-700 dark:text-gray-200': !active,
'font-bold select-none': option == currentInterval,
'font-bold cursor-none select-none': option == currentInterval,
}, 'block px-4 py-2 text-sm')}>
{INTERVAL_LABELS[option]}
</span>

@ -1,7 +1,8 @@
import React, { useState } from "react"
import * as api from '../../api'
import { getCurrentInterval } from "./interval-picker"
export default function StatsExport({site, query}) {
export default function StatsExport({site, query}) {
const [exporting, setExporting] = useState(false)
function startExport() {
@ -28,8 +29,7 @@ export default function StatsExport({site, query}) {
}
function renderExportLink() {
// FIXME const interval = getCurrentInterval(site, query)
const interval = 'day'
const interval = getCurrentInterval(site, query)
const queryParams = api.serializeQuery(query, [{ interval }])
const endpoint = `/${encodeURIComponent(site.domain)}/export${queryParams}`
@ -50,4 +50,4 @@ export default function StatsExport({site, query}) {
{!exporting && renderExportLink()}
</div>
)
}
}

@ -5,6 +5,7 @@ import classNames from "classnames";
import numberFormatter, { durationFormatter } from '../../util/number-formatter'
import * as storage from '../../util/storage'
import { formatDateRange } from '../../util/date.js'
import { getGraphableMetrics } from "./graph-util.js";
function Maybe({condition, children}) {
if (condition) {
@ -87,6 +88,18 @@ export default function TopStats(props) {
)
}
function canMetricBeGraphed(stat) {
const graphableMetrics = getGraphableMetrics(query, site)
return stat.graph_metric && graphableMetrics.includes(stat.graph_metric)
}
function maybeUpdateMetric(stat) {
if (canMetricBeGraphed(stat)) {
storage.setItem(`metric__${site.domain}`, stat.graph_metric)
onMetricUpdate(stat.graph_metric)
}
}
function blinkingDot() {
return (
<div key="dot" className="block pulsating-circle" style={{ left: '125px', top: '52px' }}></div>
@ -117,13 +130,13 @@ export default function TopStats(props) {
function renderStat(stat, index) {
const className = classNames('px-4 md:px-6 w-1/2 my-4 lg:w-auto group select-none', {
'cursor-pointer': stat.graph_metric,
'cursor-pointer': canMetricBeGraphed(stat),
'lg:border-l border-gray-300': index > 0,
'border-r lg:border-r-0': index % 2 === 0
})
return (
<Tooltip key={stat.name} info={tooltip(stat, query)} className={className} onClick={() => { onMetricUpdate(stat.graph_metric) }} boundary={tooltipBoundary}>
<Tooltip key={stat.name} info={tooltip(stat, query)} className={className} onClick={() => { maybeUpdateMetric(stat) }} boundary={tooltipBoundary}>
{renderStatName(stat)}
<div className="my-1 space-y-2">
<div>

@ -1,21 +1,25 @@
import React, { useState, useEffect, useRef, useCallback } from 'react';
import * as api from '../../api'
import * as storage from '../../util/storage'
import { getGraphableMetrics } from './graph-util'
import TopStats from './top-stats';
import { IntervalPicker } from './interval-picker'
import { IntervalPicker, getCurrentInterval } from './interval-picker'
import StatsExport from './stats-export'
import WithImportedSwitch from './with-imported-switch';
import SamplingNotice from './sampling-notice';
import FadeIn from '../../fade-in';
import * as url from '../../util/url'
import { isComparisonEnabled } from '../../comparison-input'
import LineGraphWithRouter from './line-graph'
function getStoredInterval(period, domain) {
return storage.getItem(`interval__${period}__${domain}`)
}
function fetchTopStats(site, query) {
const q = { ...query }
if (!isComparisonEnabled(q.comparison)) {
q.comparison = 'previous_period'
}
function storeInterval(period, domain, interval) {
storage.setItem(`interval__${period}__${domain}`, interval)
return api.get(url.apiPath(site, '/top-stats'), q)
}
function fetchMainGraph(site, query, metric, interval) {
@ -23,11 +27,6 @@ function fetchMainGraph(site, query, metric, interval) {
return api.get(url.apiPath(site, '/main-graph'), query, params)
}
function fetchTopReport(site, query, metric, interval) {
const params = {metric, interval}
return api.get(url.apiPath(site, '/top-report'), query, params)
}
export default function VisitorGraph(props) {
const {site, query, lastLoadTimestamp} = props
const isRealtime = query.period === 'realtime'
@ -48,17 +47,15 @@ export default function VisitorGraph(props) {
const onIntervalUpdate = useCallback((newInterval) => {
storeInterval(query.period, site.domain, newInterval)
setGraphData(null)
setGraphRefreshing(true)
fetchGraphData(getStoredMetric(), newInterval)
}, [query])
const onMetricUpdate = useCallback((newMetric) => {
storage.setItem(`metric__${site.domain}`, newMetric)
setGraphData(null)
setGraphRefreshing(true)
fetchGraphData(newMetric, getStoredInterval(query.period, site.domain))
fetchGraphData(newMetric, getCurrentInterval(site, query))
}, [query])
useEffect(() => {
@ -82,18 +79,23 @@ export default function VisitorGraph(props) {
}, [topStatData])
function fetchTopStatsAndGraphData() {
const metric = getStoredMetric()
const interval = getStoredInterval(query.period, site.domain)
fetchTopReport(site, query, metric, interval)
fetchTopStats(site, query)
.then((res) => {
storeInterval(query.period, site.domain, res.interval)
storage.setItem(`metric__${site.domain}`, res.metric)
setTopStatData(res)
setTopStatsLoading(false)
setGraphData(res)
setGraphLoading(false)
})
let metric = getStoredMetric()
const availableMetrics = getGraphableMetrics(query, site)
if (!availableMetrics.includes(metric)) {
metric = availableMetrics[0]
storage.setItem(`metric__${site.domain}`, metric)
}
const interval = getCurrentInterval(site, query)
fetchGraphData(metric, interval)
}
function fetchGraphData(metric, interval) {
@ -139,7 +141,7 @@ export default function VisitorGraph(props) {
{!isRealtime && <StatsExport site={site} query={query} />}
<SamplingNotice samplePercent={topStatData}/>
<WithImportedSwitch site={site} topStatData={topStatData} />
<IntervalPicker query={query} currentInterval={getStoredInterval(query.period, site.domain)} options={topStatData?.valid_intervals || []} onIntervalUpdate={onIntervalUpdate} />
<IntervalPicker site={site} query={query} onIntervalUpdate={onIntervalUpdate} />
</div>
<LineGraphWithRouter graphData={graphData} darkTheme={isDarkTheme} query={query} />
</div>

@ -2,9 +2,10 @@ import React from "react"
import { parseNaiveDate, isBefore } from '../../util/date'
import { Link } from 'react-router-dom'
import * as url from '../../util/url'
import { BarsArrowUpIcon } from '@heroicons/react/20/solid'
export default function WithImportedSwitch({site, topStatData}) {
if (!topStatData?.imported_source) {
if (!topStatData?.imports_exist) {
return null
}
@ -21,18 +22,15 @@ export default function WithImportedSwitch({site, topStatData}) {
const isComparingImportedPeriod = isBeforeNativeStats(topStatData.comparing_from)
if (isQueryingImportedPeriod || isComparingImportedPeriod) {
const source = topStatData.imported_source
const withImported = topStatData.with_imported;
const strike = withImported ? "" : " line-through"
const toggleColor = withImported ? " dark:text-gray-300 text-gray-700" : " dark:text-gray-500 text-gray-400"
const target = url.setQuery('with_imported', !withImported)
const tip = withImported ? "" : "do not ";
return (
<Link to={target} className="w-4 h-4 mx-2">
<div tooltip={`Stats ${tip}include data imported from ${source}.`} className="cursor-pointer w-4 h-4">
<svg className="absolute dark:text-gray-300 text-gray-700" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<text x="4" y="18" fontSize="24" fill="currentColor" className={"text-gray-700 dark:text-gray-300" + strike}>{source[0].toUpperCase()}</text>
</svg>
<div tooltip={`Stats ${tip}include imported data.`} className="cursor-pointer w-4 h-4">
<BarsArrowUpIcon className={"absolute " + toggleColor} />
</div>
</Link>
)

@ -124,3 +124,8 @@ export function isAfter(date1, date2, period) {
}
return date1.date() > date2.date()
}
export function monthsBetweenDates(date1, date2) {
var diffMonths = (date2.year() - date1.year()) * 12 + date2.month() - date1.month();
return Math.abs(diffMonths);
}

@ -10,11 +10,11 @@ export const FILTER_GROUPS = {
'utm': ['utm_medium', 'utm_source', 'utm_campaign', 'utm_term', 'utm_content'],
'goal': ['goal'],
'props': ['prop_key', 'prop_value'],
...(flags.hostname_filter ? { 'hostname': ['hostname', 'experimental_hostname_filter'] } : {})
...(flags.hostname_filter ? { 'hostname': ['hostname'] } : {})
}
export const NO_CONTAINS_OPERATOR = new Set(['experimental_hostname_filter', 'goal', 'screen'].concat(FILTER_GROUPS['location']))
export const NO_CONTAINS_OPERATOR = new Set(['goal', 'screen'].concat(FILTER_GROUPS['location']))
export const FILTER_OPERATIONS = {
isNot: 'is not',
@ -29,7 +29,7 @@ export const OPERATION_PREFIX = {
};
export function supportsIsNot(filterName) {
return !['goal', 'prop_key', 'experimental_hostname_filter'].includes(filterName)
return !['goal', 'prop_key'].includes(filterName)
}
export function isFreeChoiceFilter(filterName) {
@ -157,7 +157,6 @@ export const formattedFilters = {
'city': 'City',
'page': 'Page',
'hostname': 'Hostname',
'experimental_hostname_filter': 'Treat hostname as entry/exit hostname',
'entry_page': 'Entry Page',
'exit_page': 'Exit Page',
}

@ -38,7 +38,7 @@ config :tailwind,
config :ua_inspector,
database_path: "priv/ua_inspector",
remote_release: "6.2.1"
remote_release: "6.3.0"
config :ref_inspector,
database_path: "priv/ref_inspector"

@ -72,35 +72,36 @@ defmodule Plausible.DataMigration.SiteImports do
end_date = imported_stats_end_date(site.id, import_ids)
end_date =
if !end_date do
IO.puts(
"Site import #{site_import.id} (site ID #{site.id}) does not have any recorded stats. Setting end date to minimum."
)
if !end_date do
IO.puts(
"Site import #{site_import.id} (site ID #{site.id}) does not have any recorded stats. Removing it."
)
Date.add(site_import.start_date, 2)
else
end_date
end
end_date =
if Date.compare(end_date, site_import.end_date) in [:lt, :eq] do
end_date
else
IO.puts(
"Site import #{site_import.id} (site ID #{site.id}) computed end date is later than the current one. Skipping."
)
site_import.end_date
if site_import.legacy do
clear_imported_data(site, dry_run?)
end
site_import
|> Ecto.Changeset.change(end_date: end_date)
|> update!(dry_run?)
IO.puts(
"End date of site import #{site_import.id} (site ID #{site.id}) adjusted to #{end_date}"
)
delete!(site_import, dry_run?)
else
end_date =
if Date.compare(end_date, site_import.end_date) in [:lt, :eq] do
end_date
else
IO.puts(
"Site import #{site_import.id} (site ID #{site.id}) computed end date is later than the current one. Skipping."
)
site_import.end_date
end
site_import
|> Ecto.Changeset.change(end_date: end_date)
|> update!(dry_run?)
IO.puts(
"End date of site import #{site_import.id} (site ID #{site.id}) adjusted to #{end_date}"
)
end
end
IO.puts("Done processing site ID #{site.id}")
@ -149,6 +150,14 @@ defmodule Plausible.DataMigration.SiteImports do
end
end
defp clear_imported_data(site, false = _dry_run?) do
Repo.update_all(from(s in Site, where: s.id == ^site.id), set: [imported_data: nil])
end
defp clear_imported_data(site, true = _dry_run?) do
%{site | imported_data: nil}
end
defp update!(changeset, false = _dry_run?) do
Repo.update!(changeset)
end
@ -161,6 +170,14 @@ defmodule Plausible.DataMigration.SiteImports do
end
end
defp delete!(entity, false = _dry_run?) do
Repo.delete!(entity)
end
defp delete!(entity, true = _dry_run?) do
entity
end
defp max_date_query(schema, site_id, import_ids) do
from(q in schema,
where: q.site_id == ^site_id,

@ -140,7 +140,10 @@ defmodule Plausible.Google.GA4.HTTP do
{:error, %HTTPClient.Non200Error{} = error} when error.reason.status in [401, 403] ->
{:error, :authentication_failed}
{:error, %HTTPClient.Non200Error{} = error} ->
{:error, %{reason: :timeout}} ->
{:error, :timeout}
{:error, error} ->
Sentry.capture_message("Error listing GA4 accounts for user", extra: %{error: error})
{:error, :unknown}
end
@ -161,7 +164,10 @@ defmodule Plausible.Google.GA4.HTTP do
{:error, %HTTPClient.Non200Error{} = error} when error.reason.status in [404] ->
{:error, :not_found}
{:error, %HTTPClient.Non200Error{} = error} ->
{:error, %{reason: :timeout}} ->
{:error, :timeout}
{:error, error} ->
Sentry.capture_message("Error retrieving GA4 property #{property}",
extra: %{error: error}
)
@ -221,7 +227,10 @@ defmodule Plausible.Google.GA4.HTTP do
{:error, %HTTPClient.Non200Error{} = error} when error.reason.status in [401, 403] ->
{:error, :authentication_failed}
{:error, %HTTPClient.Non200Error{} = error} ->
{:error, %{reason: :timeout}} ->
{:error, :timeout}
{:error, error} ->
Sentry.capture_message("Error retrieving GA4 #{edge} date",
extra: %{error: error}
)

@ -108,7 +108,10 @@ defmodule Plausible.Google.UA.HTTP do
{:error, %HTTPClient.Non200Error{} = error} when error.reason.status in [401, 403] ->
{:error, :authentication_failed}
{:error, %HTTPClient.Non200Error{} = error} ->
{:error, %{reason: :timeout}} ->
{:error, :timeout}
{:error, error} ->
Sentry.capture_message("Error listing UA views for user", extra: %{error: error})
{:error, :unknown}
end
@ -170,7 +173,10 @@ defmodule Plausible.Google.UA.HTTP do
{:error, %HTTPClient.Non200Error{} = error} when error.reason.status in [401, 403] ->
{:error, :authentication_failed}
{:error, %HTTPClient.Non200Error{} = error} ->
{:error, %{reason: :timeout}} ->
{:error, :timeout}
{:error, error} ->
Sentry.capture_message("Error retrieving UA #{edge} date",
extra: %{error: error}
)

@ -62,9 +62,9 @@ defmodule Plausible.Imported do
}
end
@spec get_import(non_neg_integer()) :: SiteImport.t() | nil
def get_import(import_id) do
Repo.get(SiteImport, import_id)
@spec get_import(Site.t(), non_neg_integer()) :: SiteImport.t() | nil
def get_import(site, import_id) do
Repo.get_by(SiteImport, id: import_id, site_id: site.id)
end
defdelegate listen(), to: Imported.Importer
@ -83,6 +83,16 @@ defmodule Plausible.Imported do
end
end
@spec other_imports_in_progress?(SiteImport.t()) :: boolean()
def other_imports_in_progress?(site_import) do
Repo.exists?(
from(i in SiteImport,
where: i.site_id == ^site_import.site_id and i.id != ^site_import.id,
where: i.status in ^[SiteImport.pending(), SiteImport.importing()]
)
)
end
defp maybe_filter_by_status(query, nil), do: query
defp maybe_filter_by_status(query, status) do

@ -91,6 +91,7 @@ defmodule Plausible.Imported.Importer do
like LiveView, where notifications can be listened for via `handle_info/2`.
"""
alias Plausible.Imported
alias Plausible.Imported.SiteImport
alias Plausible.Repo
@ -98,7 +99,7 @@ defmodule Plausible.Imported.Importer do
@callback label() :: String.t()
@callback email_template() :: String.t()
@callback parse_args(map()) :: Keyword.t()
@callback import_data(Plausible.Imported.SiteImport.t(), Keyword.t()) :: :ok | {:error, any()}
@callback import_data(SiteImport.t(), Keyword.t()) :: :ok | {:error, any()}
@callback before_start(SiteImport.t()) :: :ok | {:ok, map()} | {:error, any()}
@callback on_success(SiteImport.t(), map()) :: :ok
@callback on_failure(SiteImport.t()) :: :ok
@ -108,7 +109,7 @@ defmodule Plausible.Imported.Importer do
@behaviour Plausible.Imported.Importer
@spec new_import(Plausible.Site.t(), Plausible.Auth.User.t(), Keyword.t()) ::
{:ok, Oban.Job.t()} | {:error, Ecto.Changeset.t()}
{:ok, Oban.Job.t()} | {:error, Ecto.Changeset.t() | :import_in_progress}
def new_import(site, user, opts) do
Plausible.Imported.Importer.new_import(name(), site, user, opts, &before_start/1)
end
@ -222,11 +223,15 @@ defmodule Plausible.Imported.Importer do
:ok = listen()
end
opts
|> Keyword.put(:import_id, site_import.id)
|> Map.new()
|> Plausible.Workers.ImportAnalytics.new()
|> Oban.insert()
if not Imported.other_imports_in_progress?(site_import) do
opts
|> Keyword.put(:import_id, site_import.id)
|> Map.new()
|> Plausible.Workers.ImportAnalytics.new()
|> Oban.insert()
else
{:error, :import_in_progress}
end
end
defp mark_complete(site_import, extra_data, on_success_fun) do

@ -118,10 +118,6 @@ defmodule Plausible.Stats.FilterSuggestions do
end)
end
def filter_suggestions(_site, _query, "experimental_hostname_filter", _filter_search) do
wrap_suggestions(["true", "false"])
end
def filter_suggestions(site, _query, "goal", filter_search) do
site
|> Plausible.Goals.for_site()

@ -24,8 +24,4 @@ defmodule Plausible.Stats.Metrics do
def from_string!(str) do
Map.fetch!(@metric_mappings, str)
end
def from_string(str, default) do
Map.get(@metric_mappings, str, default)
end
end

@ -10,8 +10,7 @@ defmodule Plausible.Stats.Query do
include_imported: false,
now: nil,
experimental_session_count?: false,
experimental_reduced_joins?: false,
experimental_hostname_filter?: false
experimental_reduced_joins?: false
require OpenTelemetry.Tracer, as: Tracer
alias Plausible.Stats.{Filters, Interval}
@ -26,7 +25,6 @@ defmodule Plausible.Stats.Query do
|> struct!(now: now)
|> put_experimental_session_count(site, params)
|> put_experimental_reduced_joins(site, params)
|> put_experimental_hostname_filter(params)
|> put_period(site, params)
|> put_interval(params)
|> put_parsed_filters(params)
@ -64,16 +62,6 @@ defmodule Plausible.Stats.Query do
end
end
defp put_experimental_hostname_filter(query, params) do
if Map.has_key?(params, "experimental_hostname_filter") do
struct!(query,
experimental_hostname_filter?: Map.get(params, "experimental_hostname_filter") == "true"
)
else
query
end
end
defp put_period(query, site, %{"period" => "realtime"}) do
date = today(site.timezone)

@ -96,74 +96,6 @@ defmodule PlausibleWeb.Api.StatsController do
```
"""
def top_report(conn, params) do
site = conn.assigns[:site]
with {:ok, dates} <- parse_date_params(params) do
valid_intervals = Plausible.Stats.Interval.valid_by_period(site: site)[params["period"]]
params =
if params["interval"] in valid_intervals do
params
else
Map.delete(params, "interval")
end
query = Query.from(site, params)
timeseries_query =
if query.period == "realtime" do
%Query{query | period: "30m"}
else
query
end
comparison_opts = parse_comparison_opts(params)
comparison_query =
case Comparisons.compare(site, query, params["comparison"], comparison_opts) do
{:ok, comparison_query} -> comparison_query
{:error, :not_supported} -> nil
end
{top_stats, sample_percent} = fetch_top_stats(site, query, comparison_query)
metric = resolve_metric(top_stats, params)
timeseries_result = Stats.timeseries(site, timeseries_query, [metric])
comparison_result =
if comparison_query, do: Stats.timeseries(site, comparison_query, [metric])
labels = label_timeseries(timeseries_result, comparison_result)
present_index = present_index_for(site, query, labels)
full_intervals = build_full_intervals(query, labels)
valid_intervals = Plausible.Stats.Interval.valid_by_period(site: site)[query.period]
json(conn, %{
metric: metric,
plot: plot_timeseries(timeseries_result, metric),
labels: labels,
comparison_plot: comparison_result && plot_timeseries(comparison_result, metric),
comparison_labels: comparison_result && label_timeseries(comparison_result, nil),
comparing_from: comparison_result && comparison_query.date_range.first,
comparing_to: comparison_result && comparison_query.date_range.last,
present_index: present_index,
interval: query.interval,
with_imported: with_imported?(query, comparison_query),
imports_exist: site.complete_import_ids != [],
full_intervals: full_intervals,
from: query.date_range.first,
to: query.date_range.last,
valid_intervals: valid_intervals,
top_stats: top_stats,
sample_percent: sample_percent
})
else
{:error, message} when is_binary(message) -> bad_request(conn, message)
end
end
def main_graph(conn, params) do
site = conn.assigns[:site]
@ -171,7 +103,7 @@ defmodule PlausibleWeb.Api.StatsController do
:ok <- validate_interval(params),
:ok <- validate_interval_granularity(site, params, dates),
query = Query.from(site, params),
metric <- Plausible.Stats.Metrics.from_string(params["metric"], :visitors) do
{:ok, metric} <- parse_and_validate_graph_metric(params, query) do
timeseries_query =
if query.period == "realtime" do
%Query{query | period: "30m"}
@ -527,7 +459,7 @@ defmodule PlausibleWeb.Api.StatsController do
pagination = parse_pagination(params)
query =
if query.experimental_hostname_filter? and query.filters["event:hostname"] do
if query.filters["event:hostname"] do
Query.put_filter(query, "visit:entry_page_hostname", query.filters["event:hostname"])
else
query
@ -839,7 +771,7 @@ defmodule PlausibleWeb.Api.StatsController do
metrics = breakdown_metrics(query, [:visits, :visit_duration])
query =
if query.experimental_hostname_filter? and query.filters["event:hostname"] do
if query.filters["event:hostname"] do
Query.put_filter(query, "visit:entry_page_hostname", query.filters["event:hostname"])
else
query
@ -876,7 +808,7 @@ defmodule PlausibleWeb.Api.StatsController do
metrics = breakdown_metrics(query, [:visits])
query =
if query.experimental_hostname_filter? and query.filters["event:hostname"] do
if query.filters["event:hostname"] do
Query.put_filter(query, "visit:exit_page_hostname", query.filters["event:hostname"])
else
query
@ -1424,6 +1356,23 @@ defmodule PlausibleWeb.Api.StatsController do
end
end
defp parse_and_validate_graph_metric(params, query) do
metric =
case params["metric"] do
nil -> :visitors
"conversions" -> :visitors
m -> Plausible.Stats.Metrics.from_string!(m)
end
requires_goal_filter? = metric in [:conversion_rate, :events]
if requires_goal_filter? and !query.filters["event:goal"] do
{:error, "Metric `#{metric}` can only be queried with a goal filter"}
else
{:ok, metric}
end
end
defp bad_request(conn, message, extra \\ %{}) do
payload = Map.merge(extra, %{error: message})
@ -1433,21 +1382,6 @@ defmodule PlausibleWeb.Api.StatsController do
|> halt()
end
defp resolve_metric(top_stats, params) do
available_metrics =
top_stats
|> Enum.map(& &1[:graph_metric])
|> Enum.reject(&is_nil/1)
requested_metric = Plausible.Stats.Metrics.from_string(params["metric"], :visitors)
if requested_metric in available_metrics do
requested_metric
else
List.first(available_metrics)
end
end
defp parse_comparison_opts(params) do
[
from: params["compare_from"],

@ -96,6 +96,14 @@ defmodule PlausibleWeb.GoogleAnalyticsController do
)
|> redirect(external: redirect_route)
{:error, :timeout} ->
conn
|> put_flash(
:error,
"Google Analytics API has timed out. Please try again."
)
|> redirect(external: redirect_route)
{:error, _any} ->
conn
|> put_flash(
@ -168,6 +176,14 @@ defmodule PlausibleWeb.GoogleAnalyticsController do
)
|> redirect(external: redirect_route)
{:error, :timeout} ->
conn
|> put_flash(
:error,
"Google Analytics API has timed out. Please try again."
)
|> redirect(external: redirect_route)
{:error, _any} ->
conn
|> put_flash(
@ -225,6 +241,14 @@ defmodule PlausibleWeb.GoogleAnalyticsController do
)
|> redirect(external: redirect_route)
{:error, :timeout} ->
conn
|> put_flash(
:error,
"Google Analytics API has timed out. Please try again."
)
|> redirect(external: redirect_route)
{:error, :not_found} ->
conn
|> put_flash(
@ -265,48 +289,48 @@ defmodule PlausibleWeb.GoogleAnalyticsController do
Routes.site_path(conn, :settings_imports_exports, site.domain)
end
case Imported.check_dates(site, start_date, end_date) do
{:ok, start_date, end_date} ->
if Google.API.property?(property_or_view) do
{:ok, _} =
Imported.GoogleAnalytics4.new_import(
site,
current_user,
property: property_or_view,
label: property_or_view,
start_date: start_date,
end_date: end_date,
access_token: access_token,
refresh_token: refresh_token,
token_expires_at: expires_at
)
else
{:ok, _} =
Imported.UniversalAnalytics.new_import(
site,
current_user,
view_id: property_or_view,
label: property_or_view,
start_date: start_date,
end_date: end_date,
access_token: access_token,
refresh_token: refresh_token,
token_expires_at: expires_at,
legacy: legacy == "true"
)
end
import_opts = [
label: property_or_view,
start_date: start_date,
end_date: end_date,
access_token: access_token,
refresh_token: refresh_token,
token_expires_at: expires_at,
legacy: legacy == "true"
]
with {:ok, start_date, end_date} <- Imported.check_dates(site, start_date, end_date),
import_opts = [{:start_date, start_date}, {:end_date, end_date} | import_opts],
{:ok, _} <- schedule_job(site, current_user, property_or_view, import_opts) do
conn
|> put_flash(:success, "Import scheduled. An email will be sent when it completes.")
|> redirect(external: redirect_route)
else
{:error, :no_time_window} ->
conn
|> put_flash(:success, "Import scheduled. An email will be sent when it completes.")
|> put_flash(
:error,
"Import failed. No data could be imported because date range overlaps with existing data."
)
|> redirect(external: redirect_route)
{:error, :no_time_window} ->
{:error, :import_in_progress} ->
conn
|> put_flash(
:error,
"Import failed. No data could be imported because date range overlaps with existing data."
"There's another import still in progress. Please wait until it's completed or cancel it before starting a new one."
)
|> redirect(external: redirect_route)
end
end
defp schedule_job(site, current_user, property_or_view, opts) do
if Google.API.property?(property_or_view) do
opts = Keyword.put(opts, :property, property_or_view)
Imported.GoogleAnalytics4.new_import(site, current_user, opts)
else
opts = Keyword.put(opts, :view_id, property_or_view)
Imported.UniversalAnalytics.new_import(site, current_user, opts)
end
end
end

@ -652,7 +652,7 @@ defmodule PlausibleWeb.SiteController do
|> Plausible.Site.remove_imported_data()
|> Repo.update!()
site_import = Plausible.Imported.get_import(import_id) ->
site_import = Plausible.Imported.get_import(site, import_id) ->
Oban.cancel_all_jobs(
from(j in Oban.Job,
where:

@ -42,7 +42,39 @@ defmodule PlausibleWeb.Live.ImportsExportsSettings do
end
def render(assigns) do
import_in_progress? =
Enum.any?(
assigns.site_imports,
&(&1.live_status in [SiteImport.pending(), SiteImport.importing()])
)
assigns = assign(assigns, :import_in_progress?, import_in_progress?)
~H"""
<div class="mt-5 flex gap-x-4">
<.button_link
class="w-36 h-20"
theme="bright"
disabled={@import_in_progress?}
href={Plausible.Google.API.import_authorize_url(@site.id, "import", legacy: false)}
>
<img src="/images/icon/google_analytics_logo.svg" alt="Google Analytics import" />
</.button_link>
<.button_link
class="w-36 h-20"
theme="bright"
disabled={@import_in_progress?}
href={"/#{URI.encode_www_form(@site.domain)}/settings/import"}
>
<img class="h-16" src="/images/icon/csv_logo.svg" alt="New CSV import" />
</.button_link>
</div>
<p :if={@import_in_progress?} class="mt-4 text-red-400 text-sm">
No new imports can be started until the import in progress is completed or cancelled.
</p>
<header class="relative border-b border-gray-200 pb-4">
<h3 class="mt-8 text-md leading-6 font-medium text-gray-900 dark:text-gray-100">
Existing Imports

@ -135,7 +135,6 @@ defmodule PlausibleWeb.Router do
get "/:domain/current-visitors", StatsController, :current_visitors
get "/:domain/main-graph", StatsController, :main_graph
get "/:domain/top-report", StatsController, :top_report
get "/:domain/top-stats", StatsController, :top_stats
get "/:domain/sources", StatsController, :sources
get "/:domain/utm_mediums", StatsController, :utm_mediums

@ -10,24 +10,6 @@
<PlausibleWeb.Components.Generic.docs_info slug="google-analytics-import" />
</header>
<div class="mt-5 flex gap-x-4">
<PlausibleWeb.Components.Generic.button_link
class="w-36 h-20"
theme="bright"
href={Plausible.Google.API.import_authorize_url(@site.id, "import", legacy: false)}
>
<img src="/images/icon/google_analytics_logo.svg" alt="Google Analytics import" />
</PlausibleWeb.Components.Generic.button_link>
<PlausibleWeb.Components.Generic.button_link
class="w-36 h-20"
theme="bright"
href={"/#{URI.encode_www_form(@site.domain)}/settings/import"}
>
<img class="h-16" src="/images/icon/csv_logo.svg" alt="New CSV import" />
</PlausibleWeb.Components.Generic.button_link>
</div>
<%= live_render(@conn, PlausibleWeb.Live.ImportsExportsSettings,
session: %{"domain" => @site.domain}
) %>

@ -28,11 +28,11 @@
Please subscribe to the appropriate tier with the link below to access the stats again.
</p>
<p class="mt-6 text-sm text-gray-500">
You can check the
You can configure your
<.styled_link href={Routes.site_path(@conn, :settings_general, @site.domain)}>
site settings
</.styled_link>
and we're still counting the stats but your access to the dashboard is restricted.
but your access to the dashboard is restricted.
</p>
</div>
<div class="mt-6 w-full text-center">

@ -39,6 +39,9 @@
data-is-dbip={to_string(@is_dbip)}
data-current-user-role={@conn.assigns[:current_user_role]}
data-flags={Jason.encode!(@flags)}
data-valid-intervals-by-period={
Plausible.Stats.Interval.valid_by_period(site: @site) |> Jason.encode!()
}
>
</div>
<div id="modal_root"></div>

@ -147,7 +147,7 @@
"timex": {:hex, :timex, "3.7.11", "bb95cb4eb1d06e27346325de506bcc6c30f9c6dea40d1ebe390b262fad1862d1", [:mix], [{:combine, "~> 0.10", [hex: :combine, repo: "hexpm", optional: false]}, {:gettext, "~> 0.20", [hex: :gettext, repo: "hexpm", optional: false]}, {:tzdata, "~> 1.1", [hex: :tzdata, repo: "hexpm", optional: false]}], "hexpm", "8b9024f7efbabaf9bd7aa04f65cf8dcd7c9818ca5737677c7b76acbc6a94d1aa"},
"tls_certificate_check": {:hex, :tls_certificate_check, "1.21.0", "042ab2c0c860652bc5cf69c94e3a31f96676d14682e22ec7813bd173ceff1788", [:rebar3], [{:ssl_verify_fun, "~> 1.1", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm", "6cee6cffc35a390840d48d463541d50746a7b0e421acaadb833cfc7961e490e7"},
"tzdata": {:hex, :tzdata, "1.1.1", "20c8043476dfda8504952d00adac41c6eda23912278add38edc140ae0c5bcc46", [:mix], [{:hackney, "~> 1.17", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "a69cec8352eafcd2e198dea28a34113b60fdc6cb57eb5ad65c10292a6ba89787"},
"ua_inspector": {:hex, :ua_inspector, "3.8.0", "c0b0d13200a9bd509225f15ea8cf275c0bec27390a21c355746ff8b8a88c3e4d", [:mix], [{:hackney, "~> 1.0", [hex: :hackney, repo: "hexpm", optional: false]}, {:yamerl, "~> 0.7", [hex: :yamerl, repo: "hexpm", optional: false]}], "hexpm", "7c980bae82a4754075b933e0f383935a681e5a2628856ad3ecf6eb80d8139539"},
"ua_inspector": {:hex, :ua_inspector, "3.9.0", "2021bbddb1ee41f202da7f006fb09f5c5617ad579108b7b9bcf1881828462f04", [:mix], [{:hackney, "~> 1.0", [hex: :hackney, repo: "hexpm", optional: false]}, {:yamerl, "~> 0.7", [hex: :yamerl, repo: "hexpm", optional: false]}], "hexpm", "0f2d1b9806e78b14b91b6f20eaaa4a68f8989f4f2a99a376b874c295ac50a30d"},
"unicode_util_compat": {:hex, :unicode_util_compat, "0.7.0", "bc84380c9ab48177092f43ac89e4dfa2c6d62b40b8bd132b1059ecc7232f9a78", [:rebar3], [], "hexpm", "25eee6d67df61960cf6a794239566599b09e17e668d3700247bc498638152521"},
"uuid": {:hex, :uuid, "1.1.8", "e22fc04499de0de3ed1116b770c7737779f226ceefa0badb3592e64d5cfb4eb9", [:mix], [], "hexpm", "c790593b4c3b601f5dc2378baae7efaf5b3d73c4c6456ba85759905be792f2ac"},
"websock": {:hex, :websock, "0.5.3", "2f69a6ebe810328555b6fe5c831a851f485e303a7c8ce6c5f675abeb20ebdadc", [:mix], [], "hexpm", "6105453d7fac22c712ad66fab1d45abdf049868f253cf719b625151460b8b453"},

File diff suppressed because it is too large Load Diff

@ -8,13 +8,13 @@
- regex: 'NetFront'
name: 'NetFront'
- regex: 'Edge'
- regex: 'Edge/'
name: 'Edge'
- regex: 'Trident'
name: 'Trident'
- regex: '(?<!SmartHu)Blink'
- regex: 'Chrome/(?!1?\d\.|2[0-7]\.)'
name: 'Blink'
- regex: '(?:Apple)?WebKit'

@ -5,6 +5,82 @@
# @license http://www.gnu.org/licenses/lgpl.html LGPL v3 or later
###############
# Quick Search TV (https://play.google.com/store/apps/details?id=com.aospstudio.tvsearch)
- regex: 'Quick Search TV(?:/(?:Wild Moon Edition )?(\d+[\.\d]+))?'
name: 'Quick Search TV'
version: '$1'
# Skye (https://innatical.com/)
- regex: 'Skye/(\d+\.[\.\d]+)'
name: 'Skye'
version: '$1'
engine:
default: 'Blink'
# VD Browser (vpn.video.downloader)
- regex: 'VD/\d+'
name: 'VD Browser'
version: ''
engine:
default: 'Blink'
# SecureX (https://play.google.com/store/apps/details?id=com.securex.browser)
- regex: '\[(?:HB/29|PB/(?:66|81))\]'
name: 'SecureX'
version: ''
engine:
default: 'Blink'
# HotBrowser (https://play.google.com/store/apps/details?id=com.hotsurf.browser)
- regex: '\[HS/\d+\]'
name: 'HotBrowser'
version: ''
engine:
default: 'Blink'
# Proxy Browser (https://play.google.com/store/apps/details?id=proxy.browser.unblock.sites.proxybrowser.unblocksites)
- regex: '\[PB/\d+\]'
name: 'Proxy Browser'
version: ''
engine:
default: 'Blink'
# Onion Browser (https://apps.apple.com/us/app/onion-browser/id519296448)
- regex: '^Normalized (?:iPad|iPhone) \(iOS Safari\)'
name: 'Onion Browser'
version: ''
engine:
default: 'WebKit'
# fGet (https://apps.apple.com/us/app/fget-file-manager-browser/id1582654012)
- regex: 'fGet/'
name: 'fGet'
version: ''
# Nuviu (https://www.nuviu-browser.com/)
- regex: 'Nuviu/(?:(\d+[\.\d]+))?'
name: 'Nuviu'
version: '$1'
# DoCoMo (https://play.google.com/store/apps/details?id=com.airfind.browser)
- regex: 'DoCoMo/(?:(\d+[\.\d]+))?'
name: 'DoCoMo'
version: '$1'
# Airfind Secure Browser (https://play.google.com/store/apps/details?id=com.airfind.browser)
- regex: 'com.airfind.browser/(?:(\d+[\.\d]+))?'
name: 'Airfind Secure Browser'
version: '$1'
engine:
default: 'Blink'
# Arc (https://arc.net/)
- regex: 'ArcMobile2/.+CFNetwork'
name: 'Arc'
version: ''
engine:
default: 'WebKit'
# Nuanti Meta (http://meta.nuanti.com/)
- regex: 'Nuanti(?:Meta)?/(\d+\.[\.\d]+)'
name: 'Nuanti Meta'
@ -119,6 +195,11 @@
version: '$1'
engine:
default: 'Blink'
- regex: 'Lilo/.+CFNetwork'
name: 'Lilo'
version: ''
engine:
default: 'WebKit'
# Lexi Browser (https://play.google.com/store/apps/details?id=com.lexi.browser)
- regex: 'lexi/(\d+[\.\d]+)'
@ -302,7 +383,7 @@
name: 'Edge WebView'
version: '$1'
engine:
default: 'WebKit'
default: 'Blink'
# Mandarin (https://mandarin-browser.com/)
- regex: 'Mandarin Browser/(\d+[\.\d]+)'
@ -850,7 +931,7 @@
name: 'Firefox Reality'
version: ''
# AVG Secure Browser (https://www.avg.com/en-us/secure-browser)
# AVG Secure Browser (https://www.avg.com/en-us/secure-browser | https://play.google.com/store/apps/details?id=com.avg.android.secure.browser)
- regex: 'AVG(?:/(\d+[\.\d]+))?'
name: 'AVG Secure Browser'
version: '$1'
@ -858,6 +939,11 @@
default: 'WebKit'
versions:
28: 'Blink'
- regex: 'AT/(\d+[\.\d]+)'
name: 'AVG Secure Browser'
version: '$1'
engine:
default: 'Blink'
# START Internet Browser (https://play.google.com/store/apps/details?id=fyi.start.web.browser)
- regex: 'Start/(?:(\d+[\.\d]+))?'
@ -1111,11 +1197,16 @@
version: '$1'
engine:
default: 'WebKit'
- regex: 'Chrome/.*QwantMobile(?:/(\d+[\.\d]+))?'
name: 'Qwant Mobile'
version: '$1'
engine:
default: 'Blink'
- regex: 'QwantMobile(?:/(\d+[\.\d]+))?'
name: 'Qwant Mobile'
version: '$1'
engine:
default: 'Gecko'
default: '' # multiple (Gecko on Android, WebKit on iOS)
- regex: 'Qwant/(\d+[\.\d]+)'
name: 'Qwant Mobile'
version: '$1'
@ -1186,7 +1277,7 @@
name: 'Sailfish Browser'
version: '$1'
engine:
default: 'Gecko'
default: ''
# IceCat
- regex: 'IceCat(?:/(\d+[\.\d]+))?'
@ -1719,7 +1810,7 @@
default: '' # multi engine
#Comodo Dragon
- regex: '(?:Comodo[ _])?Dragon(?!fruit)(?:/(\d+[\.\d]+))?'
- regex: '(?:Comodo[ _])?Dragon/(\d+[\.\d]+)'
name: 'Comodo Dragon'
version: '$1'
engine:
@ -1832,7 +1923,7 @@
engine:
default: 'WebKit'
versions:
'4.5': 'Blink'
'4.2': 'Blink'
- regex: '(?:Maxthon(?:%20Browser)?|MxBrowser(?:-inhouse|-iPhone)?|MXiOS)[ /](\d+[\.\d]+)?'
name: 'Maxthon'
version: '$1'
@ -1868,7 +1959,7 @@
versions:
28: 'Blink'
- regex: 'Iron(?:/(\d+[\.\d]+))?'
- regex: 'Iron/(\d+[\.\d]+)'
name: 'Iron'
version: '$1'
engine:
@ -1976,14 +2067,14 @@
name: 'Streamy'
version: '$1'
engine:
default: 'WebKit'
default: ''
#Isivioo (Android version is Chrome based)
- regex: 'isivioo'
name: 'Isivioo'
version: ''
engine:
default: 'WebKit'
default: ''
#UC Browser
- regex: 'UC[ ]?Browser(?:[ /]?(\d+[\.\d]+))?'
@ -2032,12 +2123,12 @@
name: 'Web Explorer'
version: '$1'
engine:
default: 'WebKit'
default: 'Blink'
- regex: 'webexplorer/(\d+)'
name: 'Web Explorer'
version: '$1'
engine:
default: 'WebKit'
default: ''
# Seznam Browser
- regex: 'Chrome.+SznProhlizec/(\d+[\.\d]+)'
@ -2193,28 +2284,28 @@
name: 'Quark'
version: '$1'
engine:
default: 'WebKit'
default: 'Blink'
# Monument Browser
- regex: 'MonumentBrowser(?:/(\d+[\.\d]+))?'
name: 'Monument Browser'
version: '$1'
engine:
default: 'WebKit'
default: 'Blink'
# Blue Browser
- regex: 'BlueBrowser(?:/(\d+[\.\d]+))?'
name: 'Blue Browser'
version: '$1'
engine:
default: 'WebKit'
default: 'Blink'
# Japan Browser (https://play.google.com/store/apps/details?id=com.japan.browser.anti.blokir)
- regex: 'JAPAN Browser(?:/(\d+[\.\d]+))?'
name: 'Japan Browser'
version: '$1'
engine:
default: 'WebKit'
default: 'Blink'
- regex: 'OpenFin/(?:(\d+[\.\d]+))'
name: 'OpenFin'

@ -198,6 +198,7 @@
- regex: 'Faraday(?: v(\d+[\.\d]+))?'
name: 'Faraday'
version: '$1'
url: 'https://github.com/lostisland/faraday'
- regex: '(?:Go-http-client|Go )/?(?:(\d+[\.\d]+))?(?: package http)?'
name: 'Go-http-client'
@ -520,3 +521,48 @@
- regex: 'AppleCoreMedia/1\.0\.0'
name: 'iOS Application'
version: ''
- regex: 'cpp-httplib(?:/(\d+[\.\d]+))?'
name: 'cpp-httplib'
version: '$1'
url: 'https://github.com/yhirose/cpp-httplib'
- regex: 'Definitely-Not-Requests'
name: 'Requests'
version: ''
url: 'https://github.com/psf/requests'
- regex: 'Stealer ([\d\.]+)'
name: 'Stealer'
version: '$1'
url: 'https://github.com/hotrush/stealer/'
- regex: 'Mandrill-PHP(?:/(\d+[\.\d]+))?'
name: 'Mandrill PHP'
version: '$1'
url: 'https://bitbucket.org/mailchimp/mandrill-api-php/src/master/'
- regex: 'babashka.http-client(?:/(\d+[\.\d]+))?'
name: 'Babashka HTTP Client'
version: '$1'
url: 'https://github.com/babashka/http-client'
- regex: 'http.rb(?:/(\d+[\.\d]+))?'
name: 'http.rb'
version: '$1'
url: 'https://github.com/httprb/http'
- regex: 'node-superagent(?:/(\d+[\.\d]+))?'
name: 'superagent'
version: '$1'
url: 'https://github.com/ladjs/superagent'
- regex: 'CakePHP'
name: 'CakePHP'
version: ''
url: 'https://www.cakephp.org/'
- regex: 'request.js'
name: 'request'
version: ''
url: 'https://github.com/request/request'

@ -171,11 +171,41 @@
name: '$1'
version: '$2'
# Signal uses WhatsApp user agent
- regex: 'WhatsApp(?:/2)?$'
name: 'Signal'
version: ''
# WhatsApp Business
- regex: 'WhatsApp/([\d\.]+).+CloudAPI'
name: 'WhatsApp Business'
version: '$1'
# WhatsApp
- regex: 'WhatsApp(?:[ /]([\d\.]+))?'
- regex: 'WhatsApp(?:Electron|\-app|\-linux-app)?(?:[ /]([\d\.]+))?'
name: 'WhatsApp'
version: '$1'
# WhatsApp+2
- regex: 'YoWhatsApp2Plus(?:/(\d+[\.\d]+))?'
name: 'WhatsApp+2'
version: '$1'
# FM WhatsApp
- regex: 'YoFMWhatsApp(?:/(\d+[\.\d]+))?'
name: 'FM WhatsApp'
version: '$1'
# GBWhatsApp
- regex: '(?:Yo)?GBWhatsApp(?:/(\d+[\.\d]+))?'
name: 'GBWhatsApp'
version: '$1'
# Yo WhatsApp
- regex: 'YoYoWhatsApp(?:/(\d+[\.\d]+))?'
name: 'Yo WhatsApp'
version: '$1'
# Line
- regex: 'Line(?:[ /]([\d\.]+))'
name: 'Line'
@ -469,7 +499,7 @@
version: '$1'
# TikTok (https://apps.apple.com/app/id835599320 | https://play.google.com/store/apps/details?id=com.zhiliaoapp.musically)
- regex: '(?:TikTok[/ ]|musical_ly_|AppName/musical_ly app_version/)(\d+\.(?:[\.\d]+))?'
- regex: '(?:TikTok[/ ]|com.zhiliaoapp.musically|musical_ly_|AppName/musical_ly app_version/)(\d+\.(?:[\.\d]+))?'
name: 'TikTok'
version: '$1'
@ -1086,11 +1116,6 @@
name: 'Focus Keeper'
version: '$1'
# Quick Search TV (https://play.google.com/store/apps/details?id=com.aospstudio.tvsearch)
- regex: 'Quick Search TV/(\d+\.[\.\d]+)'
name: 'Quick Search TV'
version: '$1'
# Microsoft Store (https://www.microsoft.com/en-us/store/apps/windows)
- regex: 'WindowsStoreSDK'
name: 'Microsoft Store'
@ -1112,7 +1137,7 @@
version: '$1'
# Microsoft Bing Search (https://play.google.com/store/apps/details?id=com.microsoft.bing | https://apps.apple.com/us/app/microsoft-bing-search/id345323231)
- regex: 'BingSapphire/(\d+\.[\.\d]+)'
- regex: '(?:Bing)?Sapphire/(\d+\.[\.\d]+)'
name: 'Microsoft Bing Search'
version: '$1'
@ -1132,7 +1157,7 @@
version: '$1'
# F-Secure SAFE (https://apps.apple.com/app/f-secure-safe/id572847748)
- regex: 'FSCDCSafe (\d+\.[\.\d]+)'
- regex: 'FSCDCSafe[ /](\d+\.[\.\d]+)'
name: 'F-Secure SAFE'
version: '$1'
@ -1383,22 +1408,11 @@
name: 'Amazon Music'
version: '$1'
# Klarna (https://apps.apple.com/us/app/klarna-shop-now-pay-later/id1115120118)
- regex: 'Klarna/(\d+\.[.\d]+)'
- regex: 'Klarna/(\d+\.[.\d]+)?'
name: 'Klarna'
version: '$1'
# WhatsApp+2
- regex: 'YoWhatsApp2Plus(?:/(\d+[\.\d]+))?'
name: 'WhatsApp+2'
version: '$1'
# GBWhatsApp
- regex: 'GBWhatsApp(?:/(\d+[\.\d]+))?'
name: 'GBWhatsApp'
version: '$1'
# R (https://www.r-project.org/)
- regex: '^R/(\d+[\.\d]+)'
name: 'R'
@ -2181,11 +2195,6 @@
name: 'NPR One'
version: '$1'
# unsure what this is, but is used quite a bit
- regex: 'Trackable/([\d\.]+)'
name: 'Trackable'
version: '$1'
- regex: 'Uforia/([\d\.]+)'
name: 'Uforia'
version: '$1'
@ -2194,7 +2203,7 @@
name: 'L.A. Times'
version: ''
- regex: '(?:^NYT(?: |%20)?Audio|nytios)/([\d.]+)'
- regex: '(?:^NYT(?: |%20)?Audio(?:-iOS)?|nytios)/([\d.]+)'
name: 'The New York Times'
version: '$1'
@ -2213,3 +2222,63 @@
- regex: 'IPTV/([\d\.]+)'
name: 'IPTV'
version: '$1'
# IPTV Pro (https://play.google.com/store/apps/details?id=ru.iptvremote.android.iptv.pro)
- regex: 'IPTV Pro/([\d\.]+)'
name: 'IPTV Pro'
version: '$1'
# MetaMask (https://apps.apple.com/us/app/metamask-blockchain-wallet/id1438144202)
- regex: 'MetaMask/'
name: 'MetaMask'
version: ''
# +Simple (https://play.google.com/store/apps/details?id=com.massimple.nacion.gcba.es)
- regex: '\+Simple Browser'
name: '+Simple'
version: ''
# Bitwarden (https://bitwarden.com/)
- regex: 'Bitwarden_Mobile/([\d\.]+)'
name: 'Bitwarden'
version: '$1'
# MX Player (https://play.google.com/store/apps/details?id=com.mxtech.videoplayer.ad)
- regex: 'MXPlayer/([\d\.]+)'
name: 'MX Player'
version: '$1'
# HistoryHound
- regex: 'HistoryHound/([\d\.]+)'
name: 'HistoryHound'
version: '$1'
# Quicksilver (https://qsapp.com/)
- regex: 'Quicksilver'
name: 'Quicksilver'
version: ''
# CamScanner (https://play.google.com/store/apps/details?id=com.intsig.camscanner)
- regex: 'CamScanner/([\d\.]+)'
name: 'CamScanner'
version: '$1'
# OBS Studio (https://obsproject.com/)
- regex: 'OBS/(\d+[\.\d]+)'
name: 'OBS Studio'
version: '$1'
# XSplit Broadcaster (https://www.xsplit.com/broadcaster)
- regex: 'XSplitBroadcaster/(\d+[\.\d]+)'
name: 'XSplit Broadcaster'
version: '$1'
# Twitch Studio (https://www.twitch.tv/broadcast/studio)
- regex: 'twitch-desktop-electron-platform.*spotlight/(\d+[\.\d]+)'
name: 'Twitch Studio'
version: '$1'
# Stream Master (https://www.lovense.com/stream-master)
- regex: 'Stream Master$'
name: 'Stream Master'
version: ''

@ -88,6 +88,7 @@
'de.twokit.video.tv.cast.browser.lg': 'TV Cast'
'de.twokit.video.tv.cast.browser.samsung': 'TV Cast'
'com.cleanmaster.security': 'CM Security'
'com.antivirus.master.cmsecurity': 'CM Security'
'idm.video.free': 'IDM Video Download Manager'
'mobi.deallauncher.coupons.shopping': 'Coupons & Deals'
'com.wukongtv.wkcast.intl': 'Quick Cast'
@ -95,6 +96,11 @@
'com.fsecure.ms.kpn.veilig': 'KPN Veilig'
'com.fsecure.ms.actshield': 'ACT Shield'
'com.fsecure.ms.talktalksa': 'TalkTalk SuperSafe'
'com.fsecure.ms.dnafi': 'DNA Digiturva'
'com.fsecure.ms.teliasweden': 'Telia Trygg'
'com.fsecure.ms.upc.ch': 'UPC Internet Security'
'com.fsecure.ms.sfr': 'SFR Sécurité'
'com.fsecure.ms.sonera': 'Telia Turvapaketti'
'com.bifrostwallet.app': 'Bifrost Wallet'
'com.anydesk.anydeskandroid': 'AnyDesk Remote Desktop'
'com.google.android.youtube': 'YouTube'
@ -116,6 +122,10 @@
'com.box.video.downloader': 'BOX Video Downloader'
'com.oxoo.kinogo': 'Kinogo.ge'
'com.tradron.hdvideodownloader': 'Download Hub'
'net.daum.android.daum': 'Daum'
'com.massimple.nacion.gcba.es': '+Simple'
'com.massimple.nacion.parana.es': '+Simple'
'com.microsoft.math': 'Microsoft Math Solver'
# Vpns
'org.torproject.android': 'Orbot'
@ -125,3 +135,6 @@
'com.surfshark.vpnclient.android': 'Surfshark'
'com.omshyapps.vpn': 'Omshy VPN'
'com.kuto.vpn': 'KUTO VPN'
'com.ezt.vpn': 'EZVPN'
'com.nocardteam.nocardvpn': 'NoCard VPN'
'com.nocardteam.nocardvpn.lite': 'NoCard VPN Lite'

@ -1,5 +1,8 @@
# Browsers
'mark.via.gg': 'Via'
'mark.via.gp': 'Via'
'mark.via.gq': 'Via'
'mark.via.pm': 'Via'
'com.pure.mini.browser': 'Pure Mini Browser'
'pure.lite.browser': 'Pure Lite Browser'
'acr.browser.Hexa': 'Hexa Web Browser'
@ -95,6 +98,7 @@
'com.zeesitech.bitchutebrowser': 'Bitchute Browser'
'nova.all.video.downloader': 'Nova Video Downloader Pro'
'tukidev.pronhubbrowser.tanpavpn': 'PronHub Browser'
'com.crowbar.beaverlite': 'Frost'
'com.crowbar.beaverbrowser': 'Frost+'
'com.lenovo.browser': 'Lenovo Browser'
'com.transsion.phoenix': 'Phoenix Browser'
@ -140,6 +144,8 @@
'com.security.xvpn.z35kb.amazon': 'X-VPN'
'com.security.xvpn.z35kb.huawei': 'X-VPN'
'com.yandex.browser.lite': 'Yandex Browser Lite'
'com.yandex.browser.beta': 'Yandex Browser'
'com.yandex.browser.alpha': 'Yandex Browser'
'cz.seznam.sbrowser': 'Seznam Browser'
'com.morrisxar.nav88': 'Office Browser'
'com.rabbit.incognito.browser': 'Rabbit Private Browser'
@ -149,7 +155,7 @@
'id.browser.vivid3': 'Vivid Browser Mini'
'com.browser.yo.indian': 'Yo Browser'
'com.mercandalli.android.browser': 'G Browser'
'com.bf.browser': 'BF Browser'
'com.bf.browser': 'BXE Browser'
'com.qihoo.browser': '360 Browser'
'com.qihoo.haosou': '360 Browser'
'com.qihoo.padbrowser': '360 Browser'
@ -202,6 +208,7 @@
'com.internet.tvbrowser': 'LUJO TV Browser'
'com.logicui.tvbrowser2': 'LogicUI TV Browser'
'com.opera.browser.afin': 'Opera'
'com.opera.browser.beta': 'Opera'
'com.quark.browser': 'Quark'
'jp.co.yahoo.android.ybrowser': 'Yahoo! Japan Browser'
'com.tv.browser.open': 'Open TV Browser'
@ -225,3 +232,21 @@
'com.cavebrowser': 'Cave Browser'
'com.zordo.browser': 'Zordo Browser'
'freedom.theanarch.org.freedom': 'Freedom Browser'
'com.lechneralexander.privatebrowser': 'Private Internet Browser'
'com.airfind.browser': 'Airfind Secure Browser'
'com.securex.browser': 'SecureX'
'com.sec.android.app.sbrowser.beta': 'Samsung Browser'
'threads.thor': 'Thor'
'com.androidbull.incognito.browser': 'Incognito Browser'
'com.mosoft.godzilla': 'Godzilla Browser'
'com.oceanbrowser.mobile.android': 'Ocean Browser'
'com.qmamu.browser': 'Qmamu'
'com.techlastudio.bfbrowser': 'BF Browser'
'com.befaster.bfbrowser': 'BF Browser'
'app.nextinnovations.brokeep': 'BroKeep Browser'
'org.lilo.app': 'Lilo'
'proxy.browser.unblock.sites.proxybrowser.unblocksites': 'Proxy Browser'
'com.hotsurf.browser': 'HotBrowser'
'vpn.video.downloader': 'VD Browser'
'com.aospstudio.tvsearch': 'Quick Search TV'
'com.go.browser': 'GO Browser'

@ -5,6 +5,22 @@
# @license http://www.gnu.org/licenses/lgpl.html LGPL v3 or later
###############
# BMW (https://www.bmw.com/)
BMW:
regex: 'AFTLBT962E2(?:[);/ ]|$)'
device: 'car browser'
models:
- regex: 'AFTLBT962E2(?:[);/ ]|$)'
model: 'Car (2022)'
# Jeep (https://www.jeep.com/)
Jeep:
regex: 'AFTLFT962X3(?:[);/ ]|$)'
device: 'car browser'
models:
- regex: 'AFTLFT962X3(?:[);/ ]|$)'
model: 'Wagoneer'
# Tesla Model S
Tesla:
regex: '(?:Tesla/(?:(?:develop|feature|terminal-das-fsd-eap)-)?[0-9.]+|QtCarBrowser)'

@ -46,7 +46,7 @@ JXD:
model: 'S601 WiFi'
Sony:
regex: '(?:PlayStation ?(2|3|4 Pro|4|5|Portable|Vita)|sony_tv;ps5;|\(PS3\))'
regex: '(?:PlayStation ?(4 Pro|[2-5]|Portable|Vita)|sony_tv;ps5;|\(PS3\))'
device: 'console'
models:
- regex: 'sony_tv;ps5;'
@ -55,7 +55,7 @@ Sony:
model: 'PlayStation 4 Pro'
- regex: '\(PS3\)'
model: 'PlayStation 3'
- regex: 'PlayStation ?(2|3|4 Pro|4|5|Portable|Vita)'
- regex: 'PlayStation ?(4 Pro|[2-5]|Portable|Vita)'
model: 'PlayStation $1'
# Retroid Pocket (www.goretroid.com)

File diff suppressed because it is too large Load Diff

@ -21,7 +21,7 @@ Apple:
model: 'iPod Touch 5'
- regex: '(?:Apple-)?iPod7[C,_]?1'
model: 'iPod Touch 6'
- regex: '(?:Apple-)?iPod9[C,_]?1'
- regex: '(?:Apple-)?iPod9[C,_]?1|iPodTouch7'
model: 'iPod Touch 7'
- regex: '(?:Apple-)?iPod'
model: 'iPod Touch'

@ -952,9 +952,11 @@ Silva Schneider:
# Skyworth
Skyworth:
regex: 'Sky_worth'
regex: 'Sky_worth|SWTV[;,]'
device: 'tv'
models:
- regex: 'SKWE20E21'
model: 'SKWE20E21'
- regex: 'Sky_worth;([^);/]+)'
model: '$1'
@ -986,14 +988,6 @@ Sony:
- regex: '(K[DM]L?-?[0-9]{2}[A-Z]{1,2}[0-9]{1,5})'
model: '$1'
# SWTV
SWTV:
regex: 'SWTV[;,]'
device: 'tv'
models:
- regex: 'SKWE20E21'
model: 'SKWE20E21'
# TD Systems
'TD Systems':
regex: 'TDSystems[;,]'

@ -5,6 +5,15 @@
# @license http://www.gnu.org/licenses/lgpl.html LGPL v3 or later
###############
# BrightSignOS (https://www.brightsign.biz/ecosystem/brightsign-os/)
##########
- regex: 'BrightSign/(?:[A-Z0-9]+)/(\d+[\.\d]+)'
name: 'BrightSignOS'
version: '$1'
- regex: 'BrightSign/(\d+[\.\d]+)'
name: 'BrightSignOS'
version: '$1'
##########
# LuneOS (https://www.webos-ports.org/)
##########
@ -426,7 +435,7 @@
name: 'Android'
version: '$1'
- regex: '(?:(?:Orca-)?(?<!like |/|RadioPublic |Anghami )Android|Adr|AOSP)[ /]?(?:[a-z]+ )?(\d+[\.\d]*)'
- regex: '(?:(?:Orca-)?(?<!like |/|RadioPublic |Anghami |Callpod Keeper for )Android|Adr|AOSP)[ /]?(?:[a-z]+ )?(\d+[\.\d]*)'
name: 'Android'
version: '$1'
@ -450,7 +459,7 @@
name: 'Android'
version: '$1'
- regex: 'BeyondPod|AntennaPod|Podkicker|DoggCatcher|Player FM|okhttp|Podcatcher Deluxe|Sonos/.+\(ACR_|Linux x86_64; Quest'
- regex: 'BeyondPod|AntennaPod|Podkicker|DoggCatcher|Player FM|okhttp|Podcatcher Deluxe|Sonos/.+\(ACR_|Linux x86_64; Quest|.*WhatsApp/.*A$'
name: 'Android'
version: ''
@ -714,7 +723,7 @@
name: 'Windows'
version: '$1'
- regex: 'mingw32|winhttp'
- regex: 'mingw32|winhttp|WhatsApp/.*W$'
name: 'Windows'
version: ''
@ -833,7 +842,7 @@
name: 'iPadOS'
version: '$1.$2'
- regex: 'iPad(?:; (?:iOS|iPadOS|iPhone OS)|.+CPU OS) ((1[3-7])+(?:[_\.]\d+)*)'
- regex: 'iPad(?:; (?:iOS|iPadOS|iPhone OS)|.+CPU (?:iPad |iPhone )?OS) ((1[3-7])+(?:[_\.]\d+)*)'
name: 'iPadOS'
version: '$1'
@ -868,9 +877,11 @@
name: 'iOS'
version: '$1'
- regex: '^(?!com.apple.Safari.SearchHelper|Safari).*CFNetwork/.+ Darwin/(\d+[\.\d]+)(?!.*(?:x86_64|i386|PowerMac|Power%20Macintosh))'
- regex: '^(?!com.apple.Safari.SearchHelper|Safari).*(?:CFNetwork|Mana)/.+ Darwin/(\d+[\.\d]+)(?!.*(?:x86_64|i386|PowerMac|Power%20Macintosh))'
name: 'iOS'
versions:
- regex: 'Darwin/23.4.0'
version: '17.4'
- regex: 'Darwin/23.3.0'
version: '17.3'
- regex: 'Darwin/23.2.0'
@ -1074,7 +1085,7 @@
name: 'iOS'
version: '$1'
- regex: '(?:Podcasts/(?:[\d\.]+)|Instacast(?:HD)?/(?:\d\.[\d\.abc]+)|Pocket Casts, iOS|\(iOS\)|iOS; Opera|Overcast|Castro|Podcat|iCatcher|RSSRadio/|MobileSafari/)(?!.*x86_64)'
- regex: '(?:Podcasts/(?:[\d\.]+)|Instacast(?:HD)?/(?:\d\.[\d\.abc]+)|Pocket Casts, iOS|\(iOS\)|iOS; Opera|Overcast|Castro|Podcat|iCatcher|RSSRadio/|MobileSafari/|WhatsApp/.*i$)(?!.*x86_64)'
name: 'iOS'
version: ''
@ -1097,9 +1108,11 @@
##########
# Mac
##########
- regex: '(?:CFNetwork|StudioDisplay)/.+Darwin(?:/|; )(?:[\d\.]+).+(?:x86_64|i386|Power%20Macintosh)|(?:x86_64-apple-)?darwin(?:[\d\.]+)|PowerMac|com.apple.Safari.SearchHelper|^Safari'
- regex: '(?:CFNetwork|Mana|StudioDisplay)/.+Darwin(?:/|; )(?:[\d\.]+).+(?:x86_64|i386|Power%20Macintosh)|(?:x86_64-apple-)?darwin(?:[\d\.]+)|PowerMac|com.apple.Safari.SearchHelper|^Safari'
name: 'Mac'
versions:
- regex: '(?:x86_64-apple-)?Darwin(?:/|; )?23.4.0'
version: '14.4'
- regex: '(?:x86_64-apple-)?Darwin(?:/|; )?23.3.0'
version: '14.3'
- regex: '(?:x86_64-apple-)?Darwin(?:/|; )?23.2.0'
@ -1293,7 +1306,7 @@
name: 'Mac'
version: '$1'
- regex: 'Darwin|Macintosh|Mac_PowerPC|PPC|Mac PowerPC|iMac|MacBook|macOS|AppleExchangeWebServices|com.apple.trustd|Sonos/.+\(MDCR_'
- regex: 'Darwin|Macintosh|Mac[ _]PowerPC|PPC|iMac|MacBook|macOS|AppleExchangeWebServices|com.apple.trustd|Sonos/.+\(MDCR_|WhatsApp/.*N$'
name: 'Mac'
version: ''

@ -229,6 +229,24 @@
- "ZR"
- "D6"
- "F6"
- "RC"
- "WD"
- "P3"
- "FT"
- "A9"
- "X2"
- "N3"
- "GD"
- "O9"
- "Q3"
- "F7"
- "K2"
- "P5"
- "H5"
- "V3"
- "K3"
- "Q4"
- "G2"
- ""
- "Firefox":
- "AX"
@ -261,7 +279,6 @@
- "PI"
- "PX"
- "QA"
- "QM"
- "S5"
- "SX"
- "TF"

@ -33,6 +33,7 @@
- "AB": "ABrowse"
- "BW": "AdBlock Browser"
- "A7": "Adult Browser"
- "A9": "Airfind Secure Browser"
- "AF": "ANT Fresco"
- "AG": "ANTGalio"
- "AL": "Aloha Browser"
@ -53,6 +54,7 @@
- "AV": "Amiga Voyager"
- "AW": "Amiga Aweb"
- "PN": "APN Browser"
- "RA": "Arc"
- "AI": "Arvin"
- "AK": "Ask.com"
- "AU": "Asus Browser"
@ -65,6 +67,7 @@
- "A1": "AwoX"
- "BA": "Beaker Browser"
- "BM": "Beamrise"
- "F7": "BF Browser"
- "BB": "BlackBerry Browser"
- "H1": "BrowseHere"
- "B8": "Browser Hup Pro"
@ -87,6 +90,7 @@
- "BN": "Borealis Navigator"
- "BR": "Brave"
- "BK": "BriskBard"
- "K2": "BroKeep Browser"
- "B3": "Browspeed Browser"
- "BX": "BrowseX"
- "BZ": "Browzar"
@ -94,7 +98,7 @@
- "4B": "BrowsBit"
- "BY": "Biyubi"
- "BF": "Byffox"
- "B4": "BF Browser"
- "B4": "BXE Browser"
- "CA": "Camino"
- "0C": "Cave Browser"
- "CL": "CCleaner"
@ -129,6 +133,7 @@
- "C5": "Chromium GOST"
- "CY": "Cyberfox"
- "CS": "Cheshire"
- "RC": "Crow Browser"
- "CT": "Crusta"
- "CG": "Craving Explorer"
- "CZ": "Crazy Browser"
@ -145,6 +150,7 @@
- "DT": "Delta Browser"
- "D0": "Desi Browser"
- "DS": "DeskBrowse"
- "D2": "DoCoMo"
- "DF": "Dolphin"
- "DZ": "Dolphin Zero"
- "DO": "Dorado"
@ -167,6 +173,7 @@
- "EP": "GNOME Web"
- "G1": "G Browser"
- "ES": "Espial TV Browser"
- "FG": "fGet"
- "FA": "Falkon"
- "FX": "Faux Browser"
- "F4": "Fiery Browser"
@ -192,6 +199,7 @@
- "F5": "Flyperlink"
- "FU": "FreeU"
- "F6": "Freedom Browser"
- "FT": "Frost"
- "F3": "Frost+"
- "FI": "Fulldive"
- "GA": "Galeon"
@ -199,10 +207,12 @@
- "GH": "Ghostery Privacy Browser"
- "GI": "GinxDroid Browser"
- "GB": "Glass Browser"
- "GD": "Godzilla Browser"
- "GE": "Google Earth"
- "GP": "Google Earth Pro"
- "GO": "GOG Galaxy"
- "GR": "GoBrowser"
- "G2": "GO Browser"
- "HB": "Harman Browser"
- "HS": "HasBrowser"
- "HA": "Hawk Turbo Browser"
@ -212,6 +222,7 @@
- "HI": "Hi Browser"
- "HO": "hola! Browser"
- "H4": "Holla Web Browser"
- "H5": "HotBrowser"
- "HJ": "HotJava"
- "HT": "HTC Browser"
- "HU": "Huawei Browser Mobile"
@ -230,6 +241,7 @@
- "IV": "Isivioo"
- "I8": "IVVI Browser"
- "IW": "Iceweasel"
- "N3": "Incognito Browser"
- "IN": "Inspect Browser"
- "I9": "Insta Browser"
- "IE": "Internet Explorer"
@ -321,6 +333,8 @@
- "WR": "NextWord Browser"
- "NT": "NTENT Browser"
- "NU": "Nuanti Meta"
- "NI": "Nuviu"
- "O9": "Ocean Browser"
- "OC": "Oculus Browser"
- "O6": "Odd Browser"
- "O1": "Opera Mini iOS"
@ -333,6 +347,7 @@
- "O5": "Office Browser"
- "HH": "OhHai Browser"
- "OE": "ONE Browser"
- "N4": "Onion Browser"
- "Y1": "Opera Crypto"
- "OX": "Opera GX"
- "OG": "Opera Neon"
@ -380,12 +395,16 @@
- "LY": "PolyBrowser"
- "PI": "PrivacyWall"
- "P4": "Privacy Explorer Fast Safe"
- "P3": "Private Internet Browser"
- "P5": "Proxy Browser"
- "P2": "Pi Browser"
- "P0": "PronHub Browser"
- "PC": "PSI Secure Browser"
- "RW": "Reqwireless WebViewer"
- "PS": "Microsoft Edge"
- "QA": "Qazweb"
- "Q3": "Qmamu"
- "Q4": "Quick Search TV"
- "Q2": "QQ Browser Lite"
- "Q1": "QQ Browser Mini"
- "QQ": "QQ Browser"
@ -422,6 +441,7 @@
- "S1": "SimpleBrowser"
- "3S": "SilverMob US"
- "SY": "Sizzy"
- "K3": "Skye"
- "SK": "Skyfire"
- "SS": "Seraphic Sraf"
- "KK": "SiteKiosk"
@ -430,6 +450,7 @@
- "S7": "SP Browser"
- "9S": "Sony Small Browser"
- "8S": "Secure Private Browser"
- "X2": "SecureX"
- "T1": "Stampy Browser"
- "7S": "7Star"
- "SQ": "Smart Browser"
@ -460,6 +481,7 @@
- "TR": "T-Browser"
- "TO": "t-online.de Browser"
- "TA": "Tao Browser"
- "TH": "Thor"
- "1T": "Tor Browser"
- "TF": "TenFourFox"
- "TB": "Tenta Browser"
@ -483,7 +505,9 @@
- "UE": "Ume Browser"
- "V0": "vBrowser"
- "VA": "Vast Browser"
- "V3": "VD Browser"
- "VE": "Venus Browser"
- "WD": "Vewd Browser"
- "N0": "Nova Video Downloader Pro"
- "VS": "Viasat Browser"
- "VI": "Vivaldi"

@ -1,2 +1,6 @@
- "Chrome":
- "Google Chrome"
- "Vewd Browser":
- "Vewd Core"
- "DuckDuckGo Privacy Browser":
- "DuckDuckGo"

@ -136,3 +136,21 @@
- "ZR"
- "D6"
- "F6"
- "P3"
- "FT"
- "A9"
- "X2"
- "NI"
- "FG"
- "TH"
- "N3"
- "GD"
- "O9"
- "Q3"
- "F7"
- "K2"
- "N4"
- "P5"
- "H5"
- "V3"
- "G2"

@ -111,6 +111,7 @@
- "ORA"
- "VID"
- "TIV"
- "BSN"
- ""
- "Mac":
- "MAC"

@ -12,6 +12,7 @@
- "QNX": "BlackBerry Tablet OS"
- "BOS": "Bliss OS"
- "BMP": "Brew"
- "BSN": "BrightSignOS"
- "CAI": "Caixa Mágica"
- "CES": "CentOS"
- "CST": "CentOS Stream"

@ -91,6 +91,22 @@ defmodule Plausible.DataMigration.SiteImportsTest do
assert site_import.source == :universal_analytics
end
test "removes site import when there are no stats" do
site =
insert(:site)
|> Site.start_import(~D[2021-01-02], ~D[2020-02-02], "Google Analytics", "ok")
|> Repo.update!()
_another_site_import = insert(:site_import, site: site)
assert capture_io(fn ->
assert :ok = SiteImports.run(dry_run?: false)
end) =~ "Processing 1 site"
site = Repo.reload!(site)
assert [] = Imported.list_all_imports(site)
end
test "leaves site and imports unchanged if everything fits" do
site =
insert(:site)

@ -43,7 +43,7 @@ defmodule Plausible.Imported.GoogleAnalytics4Test do
token_expires_at: DateTime.to_iso8601(past)
)
site_import = Plausible.Imported.get_import(job.args.import_id)
site_import = Plausible.Imported.get_import(site, job.args.import_id)
assert site_import.label == "properties/123456"

@ -436,6 +436,20 @@ defmodule PlausibleWeb.Api.StatsController.MainGraphTest do
describe "GET /api/stats/main-graph - conversion_rate plot" do
setup [:create_user, :log_in, :create_new_site]
test "returns 400 when conversion rate is queried without a goal filter", %{
conn: conn,
site: site
} do
conn =
get(
conn,
"/api/stats/#{site.domain}/main-graph?period=month&date=2021-01-01&metric=conversion_rate"
)
assert %{"error" => error} = json_response(conn, 400)
assert error =~ "can only be queried with a goal filter"
end
test "displays conversion_rate for a month", %{conn: conn, site: site} do
insert(:goal, site: site, event_name: "Signup")
@ -467,6 +481,20 @@ defmodule PlausibleWeb.Api.StatsController.MainGraphTest do
describe "GET /api/stats/main-graph - events (total conversions) plot" do
setup [:create_user, :log_in, :create_new_site]
test "returns 400 when the `events` metric is queried without a goal filter", %{
conn: conn,
site: site
} do
conn =
get(
conn,
"/api/stats/#{site.domain}/main-graph?period=month&date=2021-01-01&metric=events"
)
assert %{"error" => error} = json_response(conn, 400)
assert error =~ "`events` can only be queried with a goal filter"
end
test "displays total conversions for a goal", %{conn: conn, site: site} do
insert(:goal, site: site, event_name: "Signup")

@ -1384,58 +1384,7 @@ defmodule PlausibleWeb.Api.StatsController.PagesTest do
]
end
test "returns top entry pages by visitors filtered by hostname", %{conn: conn, site: site} do
populate_stats(site, [
build(:pageview,
pathname: "/page1",
hostname: "en.example.com",
timestamp: ~N[2021-01-01 00:00:00]
),
build(:pageview,
pathname: "/page1",
hostname: "es.example.com",
timestamp: ~N[2021-01-01 00:00:00]
),
build(:pageview,
pathname: "/page2",
hostname: "en.example.com",
user_id: @user_id,
timestamp: ~N[2021-01-01 00:00:00]
),
build(:pageview,
pathname: "/page2",
hostname: "es.example.com",
user_id: @user_id,
timestamp: ~N[2021-01-01 00:15:00]
),
build(:pageview,
pathname: "/exit",
hostname: "es.example.com",
user_id: @user_id,
timestamp: ~N[2021-01-01 00:16:00]
),
build(:pageview,
pathname: "/page2",
hostname: "es.example.com",
timestamp: ~N[2021-01-01 23:15:00]
)
])
filters = Jason.encode!(%{"hostname" => "es.example.com"})
conn =
get(
conn,
"/api/stats/#{site.domain}/entry-pages?period=day&date=2021-01-01&filters=#{filters}"
)
assert json_response(conn, 200) == [
%{"name" => "/page2", "visit_duration" => 480, "visitors" => 2, "visits" => 2},
%{"name" => "/page1", "visit_duration" => 0, "visitors" => 1, "visits" => 1}
]
end
test "returns top entry pages by visitors filtered by hostname with experimental_hostname_filter",
test "returns top entry pages by visitors filtered by hostname",
%{conn: conn, site: site} do
populate_stats(site, [
build(:pageview,
@ -1478,7 +1427,7 @@ defmodule PlausibleWeb.Api.StatsController.PagesTest do
conn =
get(
conn,
"/api/stats/#{site.domain}/entry-pages?period=day&date=2021-01-01&filters=#{filters}&experimental_hostname_filter=true"
"/api/stats/#{site.domain}/entry-pages?period=day&date=2021-01-01&filters=#{filters}"
)
# We're going to only join sessions where the exit hostname matches the filter
@ -1638,54 +1587,7 @@ defmodule PlausibleWeb.Api.StatsController.PagesTest do
]
end
test "returns top exit pages by visitors filtered by hostname", %{conn: conn, site: site} do
populate_stats(site, [
build(:pageview,
pathname: "/page1",
hostname: "en.example.com",
timestamp: ~N[2021-01-01 00:00:00]
),
build(:pageview,
pathname: "/page1",
hostname: "es.example.com",
timestamp: ~N[2021-01-01 00:00:00]
),
build(:pageview,
pathname: "/page1",
hostname: "en.example.com",
user_id: @user_id,
timestamp: ~N[2021-01-01 00:00:00]
),
build(:pageview,
pathname: "/page2",
hostname: "es.example.com",
user_id: @user_id,
timestamp: ~N[2021-01-01 00:15:00]
),
build(:pageview,
pathname: "/exit",
hostname: "en.example.com",
user_id: @user_id,
timestamp: ~N[2021-01-01 00:16:00]
)
])
filters = Jason.encode!(%{hostname: "es.example.com"})
conn =
get(
conn,
"/api/stats/#{site.domain}/exit-pages?period=day&date=2021-01-01&filters=#{filters}"
)
assert json_response(conn, 200) ==
[
%{"name" => "/exit", "visitors" => 1, "visits" => 1},
%{"name" => "/page1", "visitors" => 1, "visits" => 1}
]
end
test "returns top exit pages by visitors filtered by hostname with experimental_hostname_filter",
test "returns top exit pages by visitors filtered by hostname",
%{conn: conn, site: site} do
populate_stats(site, [
build(:pageview,
@ -1723,7 +1625,7 @@ defmodule PlausibleWeb.Api.StatsController.PagesTest do
conn =
get(
conn,
"/api/stats/#{site.domain}/exit-pages?period=day&date=2021-01-01&filters=#{filters}&experimental_hostname_filter=true"
"/api/stats/#{site.domain}/exit-pages?period=day&date=2021-01-01&filters=#{filters}"
)
# We're going to only join sessions where the entry hostname matches the filter

@ -1221,49 +1221,7 @@ defmodule PlausibleWeb.Api.StatsController.SourcesTest do
]
end
test "returns top referrers for a custom goal and filtered by hostname", %{
conn: conn,
site: site
} do
populate_stats(site, [
build(:pageview,
hostname: "blog.example.com",
referrer_source: "Facebook",
user_id: @user_id
),
build(:pageview,
hostname: "app.example.com",
pathname: "/register",
user_id: @user_id
),
build(:event,
name: "Signup",
hostname: "app.example.com",
pathname: "/register",
user_id: @user_id
)
])
filters = Jason.encode!(%{goal: "Signup", hostname: "app.example.com"})
conn =
get(
conn,
"/api/stats/#{site.domain}/sources?period=day&filters=#{filters}"
)
assert json_response(conn, 200) ==
[
%{
"conversion_rate" => 100.0,
"name" => "Facebook",
"total_visitors" => 1,
"visitors" => 1
}
]
end
test "returns no top referrers for a custom goal and filtered by hostname and experimental_hostname_filter",
test "returns no top referrers for a custom goal and filtered by hostname",
%{
conn: conn,
site: site
@ -1292,13 +1250,13 @@ defmodule PlausibleWeb.Api.StatsController.SourcesTest do
conn =
get(
conn,
"/api/stats/#{site.domain}/sources?period=day&filters=#{filters}&experimental_hostname_filter=true"
"/api/stats/#{site.domain}/sources?period=day&filters=#{filters}"
)
assert json_response(conn, 200) == []
end
test "returns top referrers for a custom goal and filtered by hostname and experimental_hostname_filter",
test "returns top referrers for a custom goal and filtered by hostname (2)",
%{
conn: conn,
site: site
@ -1323,7 +1281,7 @@ defmodule PlausibleWeb.Api.StatsController.SourcesTest do
conn =
get(
conn,
"/api/stats/#{site.domain}/sources?period=day&filters=#{filters}&experimental_hostname_filter=true"
"/api/stats/#{site.domain}/sources?period=day&filters=#{filters}"
)
assert json_response(conn, 200) == [

@ -1,45 +0,0 @@
defmodule PlausibleWeb.Api.StatsController.TopReportTest do
use PlausibleWeb.ConnCase
@user_id 123
describe "GET /api/stats/top-report" do
setup [:create_user, :log_in, :create_new_site]
test "returns graph and top stats", %{conn: conn, site: site} do
populate_stats(site, [
build(:pageview, timestamp: ~N[2021-01-11 04:00:00]),
build(:pageview, timestamp: ~N[2021-01-11 05:00:00]),
build(:pageview, timestamp: ~N[2021-01-11 18:00:00])
])
conn =
get(
conn,
"/api/stats/#{site.domain}/top-report?period=day&date=2021-01-11&metric=pageviews"
)
assert %{"plot" => curr, "top_stats" => top_stats} = json_response(conn, 200)
assert [0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0] = curr
assert %{
"name" => "Unique visitors",
"value" => 3,
"graph_metric" => "visitors"
} in top_stats
end
test "always adds comparison for top stats"
test "compares both top stats and graph when requested"
test "overrides metric with default when invalid metric provided", %{site: site, conn: conn} do
# requires goal filter
conn = get(conn, "/api/stats/#{site.domain}/top-report?period=day&metric=events")
assert %{"metric" => "visitors"} = json_response(conn, 200)
end
test "overrides interval with default when invalid interval provided"
test "custom date range interval handling"
test "all time date range interval handling"
end
end

@ -803,8 +803,13 @@ defmodule PlausibleWeb.Api.StatsController.TopStatsTest do
res =
json_response(conn, 200)
assert %{"name" => "Unique visitors", "value" => 3} in res["top_stats"]
assert %{"name" => "Total visits", "value" => 3} in res["top_stats"]
assert %{"name" => "Unique visitors", "value" => 3, "graph_metric" => "visitors"} in res[
"top_stats"
]
assert %{"name" => "Total visits", "value" => 3, "graph_metric" => "visits"} in res[
"top_stats"
]
end
test "returns only visitors with specific browser", %{conn: conn, site: site} do
@ -928,8 +933,13 @@ defmodule PlausibleWeb.Api.StatsController.TopStatsTest do
res = json_response(conn, 200)
assert %{"name" => "Unique visitors", "value" => 2} in res["top_stats"]
assert %{"name" => "Total pageviews", "value" => 2} in res["top_stats"]
assert %{"name" => "Unique visitors", "value" => 2, "graph_metric" => "visitors"} in res[
"top_stats"
]
assert %{"name" => "Total pageviews", "value" => 2, "graph_metric" => "pageviews"} in res[
"top_stats"
]
end
test "hostname glob filter", %{conn: conn, site: site} do
@ -953,8 +963,13 @@ defmodule PlausibleWeb.Api.StatsController.TopStatsTest do
res =
json_response(conn, 200)
assert %{"name" => "Unique visitors", "value" => 4} in res["top_stats"]
assert %{"name" => "Total pageviews", "value" => 6} in res["top_stats"]
assert %{"name" => "Unique visitors", "value" => 4, "graph_metric" => "visitors"} in res[
"top_stats"
]
assert %{"name" => "Total pageviews", "value" => 6, "graph_metric" => "pageviews"} in res[
"top_stats"
]
end
test "hostname glob subdomain filter", %{conn: conn, site: site} do
@ -972,7 +987,6 @@ defmodule PlausibleWeb.Api.StatsController.TopStatsTest do
])
filters = Jason.encode!(%{hostname: "*.example.com"})
# filters = Jason.encode!(%{page: "/blog/*"})
conn =
get(
@ -982,8 +996,13 @@ defmodule PlausibleWeb.Api.StatsController.TopStatsTest do
res = json_response(conn, 200)
assert %{"name" => "Unique visitors", "value" => 3} in res["top_stats"]
assert %{"name" => "Total pageviews", "value" => 4} in res["top_stats"]
assert %{"name" => "Unique visitors", "value" => 3, "graph_metric" => "visitors"} in res[
"top_stats"
]
assert %{"name" => "Total pageviews", "value" => 4, "graph_metric" => "pageviews"} in res[
"top_stats"
]
end
end

@ -139,6 +139,38 @@ defmodule PlausibleWeb.GoogleAnalyticsControllerTest do
"We were unable to authenticate your Google Analytics account"
end
test "redirects to #{view} on timeout error with flash error (legacy: #{legacy})", %{
conn: conn,
site: site
} do
expect(
Plausible.HTTPClient.Mock,
:get,
fn _url, _opts ->
{:error, %Mint.TransportError{reason: :timeout}}
end
)
conn =
conn
|> get("/#{site.domain}/import/google-analytics/property-or-view", %{
"access_token" => "token",
"refresh_token" => "foo",
"expires_at" => "2022-09-22T20:01:37.112777",
"legacy" => unquote(legacy)
})
assert redirected_to(conn, 302) ==
PlausibleWeb.Router.Helpers.site_path(
conn,
unquote(view),
site.domain
)
assert Phoenix.Flash.get(conn.assigns.flash, :error) =~
"Google Analytics API has timed out."
end
test "redirects to #{view} on list retrival failure with flash error (legacy: #{legacy})",
%{
conn: conn,
@ -460,6 +492,40 @@ defmodule PlausibleWeb.GoogleAnalyticsControllerTest do
assert Phoenix.Flash.get(conn.assigns.flash, :error) =~
"Google Analytics authentication seems to have expired."
end
test "redirects to #{view} on timeout with flash error (legacy: #{legacy})",
%{
conn: conn,
site: site
} do
expect(
Plausible.HTTPClient.Mock,
:post,
fn _url, _opts, _params ->
{:error, %Mint.TransportError{reason: :timeout}}
end
)
conn =
conn
|> post("/#{site.domain}/import/google-analytics/property-or-view", %{
"property_or_view" => "properties/428685906",
"access_token" => "token",
"refresh_token" => "foo",
"expires_at" => "2022-09-22T20:01:37.112777",
"legacy" => unquote(legacy)
})
assert redirected_to(conn, 302) ==
PlausibleWeb.Router.Helpers.site_path(
conn,
unquote(view),
site.domain
)
assert Phoenix.Flash.get(conn.assigns.flash, :error) =~
"Google Analytics API has timed out."
end
end
end
@ -624,6 +690,42 @@ defmodule PlausibleWeb.GoogleAnalyticsControllerTest do
assert Phoenix.Flash.get(conn.assigns.flash, :error) =~
"Google Analytics authentication seems to have expired."
end
test "redirects to #{view} on timeout with flash error (legacy: #{legacy})",
%{
conn: conn,
site: site
} do
expect(
Plausible.HTTPClient.Mock,
:get,
fn _url, _params ->
{:error, %Mint.TransportError{reason: :timeout}}
end
)
conn =
conn
|> get("/#{site.domain}/import/google-analytics/confirm", %{
"property_or_view" => "properties/428685906",
"access_token" => "token",
"refresh_token" => "foo",
"expires_at" => "2022-09-22T20:01:37.112777",
"start_date" => "2024-02-22",
"end_date" => "2024-02-26",
"legacy" => unquote(legacy)
})
assert redirected_to(conn, 302) ==
PlausibleWeb.Router.Helpers.site_path(
conn,
unquote(view),
site.domain
)
assert Phoenix.Flash.get(conn.assigns.flash, :error) =~
"Google Analytics API has timed out."
end
end
end
@ -753,6 +855,46 @@ defmodule PlausibleWeb.GoogleAnalyticsControllerTest do
)
end
test "does not start another import when there's any other in progress for the same site", %{
conn: conn,
site: site,
user: user
} do
{:ok, job} =
Plausible.Imported.NoopImporter.new_import(site, user,
start_date: ~D[2020-01-02],
end_date: ~D[2021-10-11]
)
post(conn, "/#{site.domain}/settings/google-import", %{
"property_or_view" => "properties/123456",
"start_date" => "2018-03-01",
"end_date" => "2022-03-01",
"access_token" => "token",
"refresh_token" => "foo",
"expires_at" => "2022-09-22T20:01:37.112777",
"legacy" => "false"
})
conn =
post(conn, "/#{site.domain}/settings/google-import", %{
"property_or_view" => "123456",
"start_date" => "2018-03-01",
"end_date" => "2022-03-01",
"access_token" => "token",
"refresh_token" => "foo",
"expires_at" => "2022-09-22T20:01:37.112777",
"legacy" => "true"
})
assert Phoenix.Flash.get(conn.assigns.flash, :error) =~
"There's another import still in progress."
assert [%{id: import_id, legacy: false}] = Plausible.Imported.list_all_imports(site)
assert job.args.import_id == import_id
end
for {legacy, view} <- [{"true", :settings_integrations}, {"false", :settings_imports_exports}] do
test "redirects to #{view} with no time window error flash error (legacy: #{legacy})", %{
conn: conn,

@ -680,6 +680,25 @@ defmodule PlausibleWeb.SiteControllerTest do
assert resp =~ "Google Analytics (123456)"
assert resp =~ "(98 page views)"
end
test "disables import buttons when there's import in progress", %{conn: conn, site: site} do
_site_import1 = insert(:site_import, site: site, status: SiteImport.completed())
_site_import2 = insert(:site_import, site: site, status: SiteImport.importing())
conn = get(conn, "/#{site.domain}/settings/imports-exports")
assert html_response(conn, 200) =~ "No new imports can be started"
end
test "enables import buttons when all imports are in completed or failed state", %{
conn: conn,
site: site
} do
_site_import1 = insert(:site_import, site: site, status: SiteImport.completed())
_site_import2 = insert(:site_import, site: site, status: SiteImport.failed())
conn = get(conn, "/#{site.domain}/settings/imports-exports")
refute html_response(conn, 200) =~ "No new imports can be started"
end
end
describe "GET /:website/settings/integrations for self-hosting" do

Loading…
Cancel
Save