From 199206babc3a2eb23c33ed36650e1e666430b860 Mon Sep 17 00:00:00 2001 From: RobertJoonas <56999674+RobertJoonas@users.noreply.github.com> Date: Mon, 25 Apr 2022 10:56:11 +0300 Subject: [PATCH] Dimensions continued (#1847) * added the first version of dimensions extension * finished dimensions script extension + updated tracking to use it * script variants build --- lib/plausible_web/plugs/tracker.ex | 3 ++- .../templates/layout/_tracking.html.eex | 10 ++-------- priv/tracker/js/analytics.js | 2 +- ...mensions.exclusions.file-downloads.hash.js | 1 + ...ns.exclusions.file-downloads.hash.local.js | 1 + ...usions.file-downloads.hash.local.manual.js | 1 + ...nloads.hash.local.manual.outbound-links.js | 1 + ...ile-downloads.hash.local.outbound-links.js | 1 + ...s.exclusions.file-downloads.hash.manual.js | 1 + ...le-downloads.hash.manual.outbound-links.js | 1 + ...ions.file-downloads.hash.outbound-links.js | 1 + ...at.dimensions.exclusions.file-downloads.js | 1 + ...ensions.exclusions.file-downloads.local.js | 1 + ....exclusions.file-downloads.local.manual.js | 1 + ...e-downloads.local.manual.outbound-links.js | 1 + ...ons.file-downloads.local.outbound-links.js | 1 + ...nsions.exclusions.file-downloads.manual.js | 1 + ...ns.file-downloads.manual.outbound-links.js | 1 + ...xclusions.file-downloads.outbound-links.js | 1 + ...sible.compat.dimensions.exclusions.hash.js | 1 + ...compat.dimensions.exclusions.hash.local.js | 1 + ...dimensions.exclusions.hash.local.manual.js | 1 + ...usions.hash.local.manual.outbound-links.js | 1 + ...ns.exclusions.hash.local.outbound-links.js | 1 + ...ompat.dimensions.exclusions.hash.manual.js | 1 + ...s.exclusions.hash.manual.outbound-links.js | 1 + ...mensions.exclusions.hash.outbound-links.js | 1 + .../plausible.compat.dimensions.exclusions.js | 1 + ...ible.compat.dimensions.exclusions.local.js | 1 + ...mpat.dimensions.exclusions.local.manual.js | 1 + ....exclusions.local.manual.outbound-links.js | 1 + ...ensions.exclusions.local.outbound-links.js | 1 + ...ble.compat.dimensions.exclusions.manual.js | 1 + ...nsions.exclusions.manual.outbound-links.js | 1 + ...at.dimensions.exclusions.outbound-links.js | 1 + ...e.compat.dimensions.file-downloads.hash.js | 1 + ...at.dimensions.file-downloads.hash.local.js | 1 + ...nsions.file-downloads.hash.local.manual.js | 1 + ...nloads.hash.local.manual.outbound-links.js | 1 + ...ile-downloads.hash.local.outbound-links.js | 1 + ...t.dimensions.file-downloads.hash.manual.js | 1 + ...le-downloads.hash.manual.outbound-links.js | 1 + ...ions.file-downloads.hash.outbound-links.js | 1 + ...usible.compat.dimensions.file-downloads.js | 1 + ....compat.dimensions.file-downloads.local.js | 1 + ....dimensions.file-downloads.local.manual.js | 1 + ...e-downloads.local.manual.outbound-links.js | 1 + ...ons.file-downloads.local.outbound-links.js | 1 + ...compat.dimensions.file-downloads.manual.js | 1 + ...ns.file-downloads.manual.outbound-links.js | 1 + ...imensions.file-downloads.outbound-links.js | 1 + .../js/plausible.compat.dimensions.hash.js | 1 + .../plausible.compat.dimensions.hash.local.js | 1 + ...ble.compat.dimensions.hash.local.manual.js | 1 + ...nsions.hash.local.manual.outbound-links.js | 1 + ...at.dimensions.hash.local.outbound-links.js | 1 + ...plausible.compat.dimensions.hash.manual.js | 1 + ...t.dimensions.hash.manual.outbound-links.js | 1 + ...e.compat.dimensions.hash.outbound-links.js | 1 + .../tracker/js/plausible.compat.dimensions.js | 1 + .../js/plausible.compat.dimensions.local.js | 1 + ...lausible.compat.dimensions.local.manual.js | 1 + ....dimensions.local.manual.outbound-links.js | 1 + ....compat.dimensions.local.outbound-links.js | 1 + .../js/plausible.compat.dimensions.manual.js | 1 + ...compat.dimensions.manual.outbound-links.js | 1 + ...usible.compat.dimensions.outbound-links.js | 1 + ...e.compat.exclusions.file-downloads.hash.js | 2 +- ...at.exclusions.file-downloads.hash.local.js | 2 +- ...usions.file-downloads.hash.local.manual.js | 2 +- ...nloads.hash.local.manual.outbound-links.js | 2 +- ...ile-downloads.hash.local.outbound-links.js | 2 +- ...t.exclusions.file-downloads.hash.manual.js | 2 +- ...le-downloads.hash.manual.outbound-links.js | 2 +- ...ions.file-downloads.hash.outbound-links.js | 2 +- ...usible.compat.exclusions.file-downloads.js | 2 +- ....compat.exclusions.file-downloads.local.js | 2 +- ....exclusions.file-downloads.local.manual.js | 2 +- ...e-downloads.local.manual.outbound-links.js | 2 +- ...ons.file-downloads.local.outbound-links.js | 2 +- ...compat.exclusions.file-downloads.manual.js | 2 +- ...ns.file-downloads.manual.outbound-links.js | 2 +- ...xclusions.file-downloads.outbound-links.js | 2 +- .../js/plausible.compat.exclusions.hash.js | 2 +- .../plausible.compat.exclusions.hash.local.js | 2 +- ...ble.compat.exclusions.hash.local.manual.js | 2 +- ...usions.hash.local.manual.outbound-links.js | 2 +- ...at.exclusions.hash.local.outbound-links.js | 2 +- ...plausible.compat.exclusions.hash.manual.js | 2 +- ...t.exclusions.hash.manual.outbound-links.js | 2 +- ...e.compat.exclusions.hash.outbound-links.js | 2 +- .../tracker/js/plausible.compat.exclusions.js | 2 +- .../js/plausible.compat.exclusions.local.js | 2 +- ...lausible.compat.exclusions.local.manual.js | 2 +- ....exclusions.local.manual.outbound-links.js | 2 +- ....compat.exclusions.local.outbound-links.js | 2 +- .../js/plausible.compat.exclusions.manual.js | 2 +- ...compat.exclusions.manual.outbound-links.js | 2 +- ...usible.compat.exclusions.outbound-links.js | 2 +- .../plausible.compat.file-downloads.hash.js | 2 +- ...usible.compat.file-downloads.hash.local.js | 2 +- ...compat.file-downloads.hash.local.manual.js | 2 +- ...nloads.hash.local.manual.outbound-links.js | 2 +- ...ile-downloads.hash.local.outbound-links.js | 2 +- ...sible.compat.file-downloads.hash.manual.js | 2 +- ...le-downloads.hash.manual.outbound-links.js | 2 +- ...mpat.file-downloads.hash.outbound-links.js | 2 +- .../js/plausible.compat.file-downloads.js | 2 +- .../plausible.compat.file-downloads.local.js | 2 +- ...ible.compat.file-downloads.local.manual.js | 2 +- ...e-downloads.local.manual.outbound-links.js | 2 +- ...pat.file-downloads.local.outbound-links.js | 2 +- .../plausible.compat.file-downloads.manual.js | 2 +- ...at.file-downloads.manual.outbound-links.js | 2 +- ...le.compat.file-downloads.outbound-links.js | 2 +- priv/tracker/js/plausible.compat.hash.js | 2 +- .../tracker/js/plausible.compat.hash.local.js | 2 +- .../js/plausible.compat.hash.local.manual.js | 2 +- ...compat.hash.local.manual.outbound-links.js | 2 +- ...usible.compat.hash.local.outbound-links.js | 2 +- .../js/plausible.compat.hash.manual.js | 2 +- ...sible.compat.hash.manual.outbound-links.js | 2 +- .../plausible.compat.hash.outbound-links.js | 2 +- priv/tracker/js/plausible.compat.js | 2 +- priv/tracker/js/plausible.compat.local.js | 2 +- .../js/plausible.compat.local.manual.js | 2 +- ...ible.compat.local.manual.outbound-links.js | 2 +- .../plausible.compat.local.outbound-links.js | 2 +- priv/tracker/js/plausible.compat.manual.js | 2 +- .../plausible.compat.manual.outbound-links.js | 2 +- .../js/plausible.compat.outbound-links.js | 2 +- ...mensions.exclusions.file-downloads.hash.js | 1 + ...ns.exclusions.file-downloads.hash.local.js | 1 + ...usions.file-downloads.hash.local.manual.js | 1 + ...nloads.hash.local.manual.outbound-links.js | 1 + ...ile-downloads.hash.local.outbound-links.js | 1 + ...s.exclusions.file-downloads.hash.manual.js | 1 + ...le-downloads.hash.manual.outbound-links.js | 1 + ...ions.file-downloads.hash.outbound-links.js | 1 + ...le.dimensions.exclusions.file-downloads.js | 1 + ...ensions.exclusions.file-downloads.local.js | 1 + ....exclusions.file-downloads.local.manual.js | 1 + ...e-downloads.local.manual.outbound-links.js | 1 + ...ons.file-downloads.local.outbound-links.js | 1 + ...nsions.exclusions.file-downloads.manual.js | 1 + ...ns.file-downloads.manual.outbound-links.js | 1 + ...xclusions.file-downloads.outbound-links.js | 1 + .../plausible.dimensions.exclusions.hash.js | 1 + ...usible.dimensions.exclusions.hash.local.js | 1 + ...dimensions.exclusions.hash.local.manual.js | 1 + ...usions.hash.local.manual.outbound-links.js | 1 + ...ns.exclusions.hash.local.outbound-links.js | 1 + ...sible.dimensions.exclusions.hash.manual.js | 1 + ...s.exclusions.hash.manual.outbound-links.js | 1 + ...mensions.exclusions.hash.outbound-links.js | 1 + .../js/plausible.dimensions.exclusions.js | 1 + .../plausible.dimensions.exclusions.local.js | 1 + ...ible.dimensions.exclusions.local.manual.js | 1 + ....exclusions.local.manual.outbound-links.js | 1 + ...ensions.exclusions.local.outbound-links.js | 1 + .../plausible.dimensions.exclusions.manual.js | 1 + ...nsions.exclusions.manual.outbound-links.js | 1 + ...le.dimensions.exclusions.outbound-links.js | 1 + ...lausible.dimensions.file-downloads.hash.js | 1 + ...le.dimensions.file-downloads.hash.local.js | 1 + ...nsions.file-downloads.hash.local.manual.js | 1 + ...nloads.hash.local.manual.outbound-links.js | 1 + ...ile-downloads.hash.local.outbound-links.js | 1 + ...e.dimensions.file-downloads.hash.manual.js | 1 + ...le-downloads.hash.manual.outbound-links.js | 1 + ...ions.file-downloads.hash.outbound-links.js | 1 + .../js/plausible.dimensions.file-downloads.js | 1 + ...ausible.dimensions.file-downloads.local.js | 1 + ....dimensions.file-downloads.local.manual.js | 1 + ...e-downloads.local.manual.outbound-links.js | 1 + ...ons.file-downloads.local.outbound-links.js | 1 + ...usible.dimensions.file-downloads.manual.js | 1 + ...ns.file-downloads.manual.outbound-links.js | 1 + ...imensions.file-downloads.outbound-links.js | 1 + priv/tracker/js/plausible.dimensions.hash.js | 1 + .../js/plausible.dimensions.hash.local.js | 1 + .../plausible.dimensions.hash.local.manual.js | 1 + ...nsions.hash.local.manual.outbound-links.js | 1 + ...le.dimensions.hash.local.outbound-links.js | 1 + .../js/plausible.dimensions.hash.manual.js | 1 + ...e.dimensions.hash.manual.outbound-links.js | 1 + ...lausible.dimensions.hash.outbound-links.js | 1 + priv/tracker/js/plausible.dimensions.js | 1 + priv/tracker/js/plausible.dimensions.local.js | 1 + .../js/plausible.dimensions.local.manual.js | 1 + ....dimensions.local.manual.outbound-links.js | 1 + ...ausible.dimensions.local.outbound-links.js | 1 + .../tracker/js/plausible.dimensions.manual.js | 1 + ...usible.dimensions.manual.outbound-links.js | 1 + .../js/plausible.dimensions.outbound-links.js | 1 + ...lausible.exclusions.file-downloads.hash.js | 2 +- ...le.exclusions.file-downloads.hash.local.js | 2 +- ...usions.file-downloads.hash.local.manual.js | 2 +- ...nloads.hash.local.manual.outbound-links.js | 2 +- ...ile-downloads.hash.local.outbound-links.js | 2 +- ...e.exclusions.file-downloads.hash.manual.js | 2 +- ...le-downloads.hash.manual.outbound-links.js | 2 +- ...ions.file-downloads.hash.outbound-links.js | 2 +- .../js/plausible.exclusions.file-downloads.js | 2 +- ...ausible.exclusions.file-downloads.local.js | 2 +- ....exclusions.file-downloads.local.manual.js | 2 +- ...e-downloads.local.manual.outbound-links.js | 2 +- ...ons.file-downloads.local.outbound-links.js | 2 +- ...usible.exclusions.file-downloads.manual.js | 2 +- ...ns.file-downloads.manual.outbound-links.js | 2 +- ...xclusions.file-downloads.outbound-links.js | 2 +- priv/tracker/js/plausible.exclusions.hash.js | 2 +- .../js/plausible.exclusions.hash.local.js | 2 +- .../plausible.exclusions.hash.local.manual.js | 2 +- ...usions.hash.local.manual.outbound-links.js | 2 +- ...le.exclusions.hash.local.outbound-links.js | 2 +- .../js/plausible.exclusions.hash.manual.js | 2 +- ...e.exclusions.hash.manual.outbound-links.js | 2 +- ...lausible.exclusions.hash.outbound-links.js | 2 +- priv/tracker/js/plausible.exclusions.js | 2 +- priv/tracker/js/plausible.exclusions.local.js | 2 +- .../js/plausible.exclusions.local.manual.js | 2 +- ....exclusions.local.manual.outbound-links.js | 2 +- ...ausible.exclusions.local.outbound-links.js | 2 +- .../tracker/js/plausible.exclusions.manual.js | 2 +- ...usible.exclusions.manual.outbound-links.js | 2 +- .../js/plausible.exclusions.outbound-links.js | 2 +- .../js/plausible.file-downloads.hash.js | 2 +- .../js/plausible.file-downloads.hash.local.js | 2 +- ...usible.file-downloads.hash.local.manual.js | 2 +- ...nloads.hash.local.manual.outbound-links.js | 2 +- ...ile-downloads.hash.local.outbound-links.js | 2 +- .../plausible.file-downloads.hash.manual.js | 2 +- ...le-downloads.hash.manual.outbound-links.js | 2 +- ...ible.file-downloads.hash.outbound-links.js | 2 +- priv/tracker/js/plausible.file-downloads.js | 2 +- .../js/plausible.file-downloads.local.js | 2 +- .../plausible.file-downloads.local.manual.js | 2 +- ...e-downloads.local.manual.outbound-links.js | 2 +- ...ble.file-downloads.local.outbound-links.js | 2 +- .../js/plausible.file-downloads.manual.js | 2 +- ...le.file-downloads.manual.outbound-links.js | 2 +- ...plausible.file-downloads.outbound-links.js | 2 +- priv/tracker/js/plausible.hash.js | 2 +- priv/tracker/js/plausible.hash.local.js | 2 +- .../tracker/js/plausible.hash.local.manual.js | 2 +- ...usible.hash.local.manual.outbound-links.js | 2 +- .../js/plausible.hash.local.outbound-links.js | 2 +- priv/tracker/js/plausible.hash.manual.js | 2 +- .../plausible.hash.manual.outbound-links.js | 2 +- .../js/plausible.hash.outbound-links.js | 2 +- priv/tracker/js/plausible.js | 2 +- priv/tracker/js/plausible.local.js | 2 +- priv/tracker/js/plausible.local.manual.js | 2 +- .../plausible.local.manual.outbound-links.js | 2 +- .../js/plausible.local.outbound-links.js | 2 +- priv/tracker/js/plausible.manual.js | 2 +- .../js/plausible.manual.outbound-links.js | 2 +- priv/tracker/js/plausible.outbound-links.js | 2 +- tracker/compile.js | 2 +- tracker/src/plausible.js | 19 ++++++++++++++++++- 261 files changed, 280 insertions(+), 140 deletions(-) create mode 100644 priv/tracker/js/plausible.compat.dimensions.exclusions.file-downloads.hash.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.exclusions.file-downloads.hash.local.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.exclusions.file-downloads.hash.local.manual.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.exclusions.file-downloads.hash.local.manual.outbound-links.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.exclusions.file-downloads.hash.local.outbound-links.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.exclusions.file-downloads.hash.manual.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.exclusions.file-downloads.hash.manual.outbound-links.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.exclusions.file-downloads.hash.outbound-links.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.exclusions.file-downloads.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.exclusions.file-downloads.local.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.exclusions.file-downloads.local.manual.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.exclusions.file-downloads.local.manual.outbound-links.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.exclusions.file-downloads.local.outbound-links.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.exclusions.file-downloads.manual.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.exclusions.file-downloads.manual.outbound-links.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.exclusions.file-downloads.outbound-links.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.exclusions.hash.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.exclusions.hash.local.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.exclusions.hash.local.manual.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.exclusions.hash.local.manual.outbound-links.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.exclusions.hash.local.outbound-links.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.exclusions.hash.manual.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.exclusions.hash.manual.outbound-links.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.exclusions.hash.outbound-links.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.exclusions.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.exclusions.local.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.exclusions.local.manual.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.exclusions.local.manual.outbound-links.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.exclusions.local.outbound-links.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.exclusions.manual.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.exclusions.manual.outbound-links.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.exclusions.outbound-links.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.file-downloads.hash.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.file-downloads.hash.local.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.file-downloads.hash.local.manual.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.file-downloads.hash.local.manual.outbound-links.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.file-downloads.hash.local.outbound-links.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.file-downloads.hash.manual.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.file-downloads.hash.manual.outbound-links.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.file-downloads.hash.outbound-links.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.file-downloads.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.file-downloads.local.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.file-downloads.local.manual.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.file-downloads.local.manual.outbound-links.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.file-downloads.local.outbound-links.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.file-downloads.manual.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.file-downloads.manual.outbound-links.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.file-downloads.outbound-links.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.hash.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.hash.local.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.hash.local.manual.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.hash.local.manual.outbound-links.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.hash.local.outbound-links.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.hash.manual.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.hash.manual.outbound-links.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.hash.outbound-links.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.local.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.local.manual.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.local.manual.outbound-links.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.local.outbound-links.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.manual.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.manual.outbound-links.js create mode 100644 priv/tracker/js/plausible.compat.dimensions.outbound-links.js create mode 100644 priv/tracker/js/plausible.dimensions.exclusions.file-downloads.hash.js create mode 100644 priv/tracker/js/plausible.dimensions.exclusions.file-downloads.hash.local.js create mode 100644 priv/tracker/js/plausible.dimensions.exclusions.file-downloads.hash.local.manual.js create mode 100644 priv/tracker/js/plausible.dimensions.exclusions.file-downloads.hash.local.manual.outbound-links.js create mode 100644 priv/tracker/js/plausible.dimensions.exclusions.file-downloads.hash.local.outbound-links.js create mode 100644 priv/tracker/js/plausible.dimensions.exclusions.file-downloads.hash.manual.js create mode 100644 priv/tracker/js/plausible.dimensions.exclusions.file-downloads.hash.manual.outbound-links.js create mode 100644 priv/tracker/js/plausible.dimensions.exclusions.file-downloads.hash.outbound-links.js create mode 100644 priv/tracker/js/plausible.dimensions.exclusions.file-downloads.js create mode 100644 priv/tracker/js/plausible.dimensions.exclusions.file-downloads.local.js create mode 100644 priv/tracker/js/plausible.dimensions.exclusions.file-downloads.local.manual.js create mode 100644 priv/tracker/js/plausible.dimensions.exclusions.file-downloads.local.manual.outbound-links.js create mode 100644 priv/tracker/js/plausible.dimensions.exclusions.file-downloads.local.outbound-links.js create mode 100644 priv/tracker/js/plausible.dimensions.exclusions.file-downloads.manual.js create mode 100644 priv/tracker/js/plausible.dimensions.exclusions.file-downloads.manual.outbound-links.js create mode 100644 priv/tracker/js/plausible.dimensions.exclusions.file-downloads.outbound-links.js create mode 100644 priv/tracker/js/plausible.dimensions.exclusions.hash.js create mode 100644 priv/tracker/js/plausible.dimensions.exclusions.hash.local.js create mode 100644 priv/tracker/js/plausible.dimensions.exclusions.hash.local.manual.js create mode 100644 priv/tracker/js/plausible.dimensions.exclusions.hash.local.manual.outbound-links.js create mode 100644 priv/tracker/js/plausible.dimensions.exclusions.hash.local.outbound-links.js create mode 100644 priv/tracker/js/plausible.dimensions.exclusions.hash.manual.js create mode 100644 priv/tracker/js/plausible.dimensions.exclusions.hash.manual.outbound-links.js create mode 100644 priv/tracker/js/plausible.dimensions.exclusions.hash.outbound-links.js create mode 100644 priv/tracker/js/plausible.dimensions.exclusions.js create mode 100644 priv/tracker/js/plausible.dimensions.exclusions.local.js create mode 100644 priv/tracker/js/plausible.dimensions.exclusions.local.manual.js create mode 100644 priv/tracker/js/plausible.dimensions.exclusions.local.manual.outbound-links.js create mode 100644 priv/tracker/js/plausible.dimensions.exclusions.local.outbound-links.js create mode 100644 priv/tracker/js/plausible.dimensions.exclusions.manual.js create mode 100644 priv/tracker/js/plausible.dimensions.exclusions.manual.outbound-links.js create mode 100644 priv/tracker/js/plausible.dimensions.exclusions.outbound-links.js create mode 100644 priv/tracker/js/plausible.dimensions.file-downloads.hash.js create mode 100644 priv/tracker/js/plausible.dimensions.file-downloads.hash.local.js create mode 100644 priv/tracker/js/plausible.dimensions.file-downloads.hash.local.manual.js create mode 100644 priv/tracker/js/plausible.dimensions.file-downloads.hash.local.manual.outbound-links.js create mode 100644 priv/tracker/js/plausible.dimensions.file-downloads.hash.local.outbound-links.js create mode 100644 priv/tracker/js/plausible.dimensions.file-downloads.hash.manual.js create mode 100644 priv/tracker/js/plausible.dimensions.file-downloads.hash.manual.outbound-links.js create mode 100644 priv/tracker/js/plausible.dimensions.file-downloads.hash.outbound-links.js create mode 100644 priv/tracker/js/plausible.dimensions.file-downloads.js create mode 100644 priv/tracker/js/plausible.dimensions.file-downloads.local.js create mode 100644 priv/tracker/js/plausible.dimensions.file-downloads.local.manual.js create mode 100644 priv/tracker/js/plausible.dimensions.file-downloads.local.manual.outbound-links.js create mode 100644 priv/tracker/js/plausible.dimensions.file-downloads.local.outbound-links.js create mode 100644 priv/tracker/js/plausible.dimensions.file-downloads.manual.js create mode 100644 priv/tracker/js/plausible.dimensions.file-downloads.manual.outbound-links.js create mode 100644 priv/tracker/js/plausible.dimensions.file-downloads.outbound-links.js create mode 100644 priv/tracker/js/plausible.dimensions.hash.js create mode 100644 priv/tracker/js/plausible.dimensions.hash.local.js create mode 100644 priv/tracker/js/plausible.dimensions.hash.local.manual.js create mode 100644 priv/tracker/js/plausible.dimensions.hash.local.manual.outbound-links.js create mode 100644 priv/tracker/js/plausible.dimensions.hash.local.outbound-links.js create mode 100644 priv/tracker/js/plausible.dimensions.hash.manual.js create mode 100644 priv/tracker/js/plausible.dimensions.hash.manual.outbound-links.js create mode 100644 priv/tracker/js/plausible.dimensions.hash.outbound-links.js create mode 100644 priv/tracker/js/plausible.dimensions.js create mode 100644 priv/tracker/js/plausible.dimensions.local.js create mode 100644 priv/tracker/js/plausible.dimensions.local.manual.js create mode 100644 priv/tracker/js/plausible.dimensions.local.manual.outbound-links.js create mode 100644 priv/tracker/js/plausible.dimensions.local.outbound-links.js create mode 100644 priv/tracker/js/plausible.dimensions.manual.js create mode 100644 priv/tracker/js/plausible.dimensions.manual.outbound-links.js create mode 100644 priv/tracker/js/plausible.dimensions.outbound-links.js diff --git a/lib/plausible_web/plugs/tracker.ex b/lib/plausible_web/plugs/tracker.ex index e64e631d6..05049b453 100644 --- a/lib/plausible_web/plugs/tracker.ex +++ b/lib/plausible_web/plugs/tracker.ex @@ -9,7 +9,8 @@ defmodule PlausibleWeb.Tracker do "compat", "local", "manual", - "file-downloads" + "file-downloads", + "dimensions" ] base_filenames = ["plausible", "script"] diff --git a/lib/plausible_web/templates/layout/_tracking.html.eex b/lib/plausible_web/templates/layout/_tracking.html.eex index 6993d50e4..a73747d81 100644 --- a/lib/plausible_web/templates/layout/_tracking.html.eex +++ b/lib/plausible_web/templates/layout/_tracking.html.eex @@ -1,17 +1,11 @@ <%= if !Application.get_env(:plausible, :is_selfhost) && !@conn.assigns[:skip_plausible_tracking] do %> <%= if Application.get_env(:plausible, :environment) in ["prod", "staging"] do %> - + - <% end %> <%= if Application.get_env(:plausible, :environment) == "dev" do %> - + - <% end %> <% end %> diff --git a/priv/tracker/js/analytics.js b/priv/tracker/js/analytics.js index 54394c7c6..dde9e4a8a 100644 --- a/priv/tracker/js/analytics.js +++ b/priv/tracker/js/analytics.js @@ -1 +1 @@ -!function(){"use strict";var a=window.location,r=window.document,o=r.currentScript,s=o.getAttribute("data-api")||new URL(o.src).origin+"/api/event";function l(t){console.warn("Ignoring Event: "+t)}function t(t,e){if(/^localhost$|^127(\.[0-9]+){0,2}\.[0-9]+$|^\[::1?\]$/.test(a.hostname)||"file:"===a.protocol)return l("localhost");if(!(window._phantom||window.__nightmare||window.navigator.webdriver||window.Cypress)){try{if("true"===window.localStorage.plausible_ignore)return l("localStorage flag")}catch(t){}var i={};i.n=t,i.u=a.href,i.d=o.getAttribute("data-domain"),i.r=r.referrer||null,i.w=window.innerWidth,e&&e.meta&&(i.m=JSON.stringify(e.meta)),e&&e.props&&(i.p=JSON.stringify(e.props));var n=new XMLHttpRequest;n.open("POST",s,!0),n.setRequestHeader("Content-Type","text/plain"),n.send(JSON.stringify(i)),n.onreadystatechange=function(){4===n.readyState&&e&&e.callback&&e.callback()}}}var e=window.plausible&&window.plausible.q||[];window.plausible=t;for(var i,n=0;n a.length > 0).map(a => a.sort()); compilefile(relPath('src/plausible.js'), relPath('../priv/tracker/js/plausible.js')) diff --git a/tracker/src/plausible.js b/tracker/src/plausible.js index 12c9e2c11..acbe2ae7c 100644 --- a/tracker/src/plausible.js +++ b/tracker/src/plausible.js @@ -65,8 +65,25 @@ payload.m = JSON.stringify(options.meta) } if (options && options.props) { - payload.p = JSON.stringify(options.props) + payload.p = options.props } + + {{#if dimensions}} + var dimensionAttributes = scriptEl.getAttributeNames().filter(function (name) { + return name.substring(0, 6) === 'event-' + }) + + var props = payload.p || {} + + dimensionAttributes.forEach(function(attribute) { + var propKey = attribute.replace('event-', '') + var propValue = scriptEl.getAttribute(attribute) + props[propKey] = props[propKey] || propValue + }) + + payload.p = props + {{/if}} + {{#if hash}} payload.h = 1 {{/if}}