* Use prima modal in ip_rules settings
* Remove unused alias
* Do not render portal in test environment - fixes tests
* Simplify invitation modal tests
* Bump CI cache version to rebuild with prima 0.2.1
The CI was using cached dependencies with prima 0.1.9, which doesn't
support the portal parameter needed for tests. Bumping the cache
version forces a rebuild with the correct prima 0.2.1 from mix.lock.
* CI debugging
* Use correct mix env
* Resolve mix.env() at compile-time
* add module name to service_error when check times out
Otherwise, it can sometimes remain unclear in the diagnostics, whether
it was InstallationV2 or InstallationV2CacheBust that timed out.
* Remove duplicate timeout logic
The current production logs show two types of verification timeouts:
* service_error: "Unhandled Browserless response status: 408" (vast
majority of cases)
* service_error: :timeout (only a few cases)
The latter happens when we hit the Req receive_timeout
(endpoint_timeout + 2s). I've seen Browserless not respect the timeout
param from time to time, so it's better to keep the timeout logic
"in-house" only.
* make service_error into a map with code and extra
* interpret temporary service errors
...but still consider them "unhandled" for telemetry, also notifying Sentry
and logging the warning.
* separate sentry messages (verification)
* make Verification.ChecksTest more DRY
* organize tests into describe blocks
* test verification telemetry and logging
* fix codespell
* get rid of legacy verification
* rename Checks.InstallationV2 -> Checks.VerifyInstallation
* delete Live.Installation and rename Live.InstallationV2 -> Live.Installation
* rename installationv2 (live) files as well
* delete old change-domain routes
Also rename current liveview modules and routes, removing the v2 suffix
* rename domain_change_v2 files, removing v2 suffix
* remove legacy JS verifier code
Also fix dockerignore and elixir.yml referencing a wrong priv path
* rename verification_v2_test -> verification_test
* remove v2 prefix from logs and sentry messages
* clean up duplicate external_sites_controller_test.exs tests
* remove flag
* fix typespec
* pass timeout as query param to Browserless too
* Fixup external sites controller test module (#5826)
* fix test description
---------
Co-authored-by: Artur Pata <artur.pata@gmail.com>
* new verifier script with tests + telemetry
* dataDomainMismatch tests
* more tests for callbackStatus and plausibleInstalled
* create priv/verifier subfolder + fix Elixir CI
* bump CI cache version
* organize verifier tests
* Remove accidentally committed verifier
* Rework compilation: Make it a variant, always return new verifier code in tests
* Make priv/tracker/verifier/ exist
* Handle static checks with grace
* Fix paths
* Fix paths
* Add some tests
* Add one more test
* split up the JS
* proxyLikely + code structure refactor + unit tests
* fix telemetry fields
* move most telemetry to logs
* run verifier tests only on chromium
* detect wordpressPlugin and wordpressLikely
* detect GTM
* rename JS checks
* detect cookiebot
* include new fields in logs
* different logs for browserless request vs js failures
* detect manual extension
* detect unknown attrs + fix logging
* stick to Elixir checks for snippet detection
* fix codespell
* fix IO.inspect
* remove unnecessary fields from test mock
* cookiebot doc
* move test into verifier subfolder
* do not duplicate ts types
* comma -> semicolon in log
* test dynamically loaded snippet
* improve logging on Browserless error
---------
Co-authored-by: Karl-Aksel Puulmann <oxymaccy@gmail.com>
* Commit as Plausible Bot
This way commits by it can be excluded from protections
* ScriptV2: Add support for `config.transformRequest`
transformRequest allows users to either manipulate or ignore requests to plausible
with a minimal footprint.
Some use-cases we're aware of and are planning for:
1. Ignoring requests similar to previous exclusion rules in WordPress
2. Normalizing urls for requests
* Allow passing `options.url` for overriding url when calling track
Previous naming `u` was unintuitive, but is kept around (untyped) for backwards
compatibility reasons
* chore: Bump tracker_script_version to 17
* Changelog
* Update types
* Docs
* Add test showing interaction with engagement events
* README.md
* Include co-authors in basecamp notifications
* Update .github/workflows/build-private-images-ghcr.yml
Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com>
---------
Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com>
* Release process start
* Move CHANGELOG.md to tracker directory, symlink
* Update LICENSE
* Restructure symlinks to make sure files are included in `npm pack`
* Start with new flows
* New workflow for tracker script releasing
* Changelog
* typo
* Fix bump steps naming
* Scope commit to tracker/ folder
* Step naming
* PlausibleWeb.Tracker -> PlausibleWeb.TrackerPlug
* Support getting plausible-main.js via app from `/js/s-${tag}`
tag currently is site.installation_meta["id"] but im planning (separately) to
introduce a different, shorter id version (using something like NanoId/HashId).
This will be introduced in a separate PR though
* Mark some variables as legacy
* Remove compile-time dependency on plausible-main.js
* Fix build
* moduledoc
* Bump CACHE_VERSION to ensure plausible-main is compiled
* 404 consistently
* Revert "Remove compile-time dependency on plausible-main.js"
This reverts commit 4b533ef0f6.
* Ensure file exists at compile-time
* flat_map over reject
* assert -> refute
* JSON.encode!
* Add CLI arguments to compile.js and logging
* Rename folder
* Extract compile code, es modules
* Add a progress bar
* Remove handlebars
* Update report-sizes
* Remove debug code
* inline
* More generous split
* Allow positional arguments for compiling
* Add watch option to compile
* Add compileFile logic
* Most tests run under playwright
* All tests runnable
* Update playwright, remove hack
Note that upgrading to latest failed due to a new test failure. This
might be due to a chrome update.
* Compile script on the fly for tests
* Minor refactor for compileAll
* es module for generate-variants.js
* Allow passing suffix to compilation script - this can be used to generate separate files for comparison
* Fix positionals
* Switch from 2 passes to 1 pass
Did some data analysis on this data:
- Compared to master, 1 pass increased brotli size by 0.7%, 2 passes 0.4%.
Given the change is insignificant enough, we can ignore it for now
The increase is likely due to order of operations in compilation and
some inlined functions getting lost.
* Move customEvents.js to plausible.js
* Clean up API
* Suffix default
* Rework variants.json, globals stored there
* Add more variants under test
* Distribute work across multiple worker threads
Compile time went on my machine from 60s -> 30s
* Fixup server
* Update canSkipCompile
* chore: Bump tracker_script_version to 7
* Update scripts
* Update node-version
* Experiment with adding a small delay to page
* Casing
* rename variable
* Update help text
* features -> compileIds, backport functionality from other branch
* Set team when creating API key
* Create API key with team ID and adjust API key CRM
* Make CRM work with team-less API keys still
* Scope owner's API keys by team on setup
* Rate limit team scoped API keys by their team
* Enforce team scoping for API key with a team
* Prevent using legacy API keys against setup teams
* Enforce team scoping in Sites API too
* Scope API keys list in settings by team
* Do not prevent legacy API keys from accessing setup teams
* List legacy API keys across all teams
* Display "API Keys" under "Team Settings" when team is setup
* Scope teams index in Sites API as well
* Test Sites API actions
* Revert "Scope owner's API keys by team on setup"
This reverts commit 08fd5b4e801417a28ebb9937457cf3e59f7386a0.
* Test and slightly simplify API key CRM logic
* Test API key provisioning from Account Settings
* Test `AuthorizePublicApi` plug adjustments
* Simplify conditionals (h/t @aerosol)
* Change back to using `schema` in CRM logic
* Don't run tests triggering Kaffy warning locally
* Run quirky Kaffy tests only on CI in EE env
* WIP
* tracker_script_version over reportedVersion
Will make it easier to grep for this thing
* CHANGELOG.md
* Only add tracker/package.json in workflow commit
* chore: Bump tracker_script_version to 1
* Show tracker_script_version is reported in tracker tests
* Track `engagement_time` while accounting for time page is blurred (#5206)
Consider this scenario:
1. User opens page /blog
2. 3 seconds later, alt-tabs to another window
3. minute later, alt-tabs to the page and closes it
Previously, this would be reported as 1m03s engagement_time. Now this
would be reported as 3s engagement_time.
* remove redundant engagement cooldown (#5199)
---------
Co-authored-by: RobertJoonas <56999674+RobertJoonas@users.noreply.github.com>
A test in test/plausible_web/plugs/tracker_test.exs was failing due to
cached version of tracker script being used in other PRs.
The reason it didn't fail in the original PR adding the test was that
changes in tracker script bypassed the cache **for that pr**.
* Bump elixir to 1.17.3 and OTP to 27.2.1
To address https://github.com/erlang/otp/issues/8588
* Bump cache
* Bump secondary alpine
* Try unzip due to `{:error, :bad_eocd}` on OTP 27.2.1
* jfc
* Revert "jfc"
This reverts commit 018d33fadc.
* Revert "Try unzip due to `{:error, :bad_eocd}` on OTP 27.2.1"
This reverts commit e04750ff82.
* huh
* Use Plausible.File.mv!
* Another one
* fixup
* Format
* Another one
* Format
* Update test/plausible/exports_test.exs
Co-authored-by: ruslandoga <ruslandoga+gh@icloud.com>
* Bump CI cache again
---------
Co-authored-by: ruslandoga <ruslandoga+gh@icloud.com>
* use arm runners
* drop qemu
* rename jobs
* Update .github/workflows/build-public-images-ghcr.yml
* add missing runs-on
* fix build step id
* don't need ERL_FLAGS=+JMsingle true
* Channels: Migration to add column, backfill code
This change adds `acqusition_channel` columns to events_v2 and
sessions_v2 tables. These columns are materialized - we don't ingest
into them directly. Instead they're calculated based on other columns.
The data migration changes now allow to also backfill the column.
Tested the ability to change definitions by changing the function
definitions and re-running the migration with backfill. Confirmed that
the underlying data changed as expected.
* quiet option
* Exclude data migrations from validation
* Migration consistency