From fbd6e377670919ddf497959c67e3f79e407f04a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89mile=20Perron?= Date: Tue, 23 Nov 2021 03:50:06 -0500 Subject: [PATCH] Add option to specify a URL in the manual extension (#1479) * Add option to specify a URL in the manual extension * Fix error when option parameter isn't provided The uglify-js dependency had to be updated to support the optional chaining operator * Remove the possibility to pass a function for the custom URL This added weight unnecessarily, as the users can simply call the function themselves before triggering the event. * Change optional chaining to ternary for improved browser support * Revert package-lock.json to version 3.9.4 of uglify-js It was previously updated to support optional chaining; reverting it as a reminder that this is the current browser support level that is accepted by Plausible. --- CHANGELOG.md | 1 + .../js/plausible.compat.exclusions.hash.local.manual.js | 2 +- ...ible.compat.exclusions.hash.local.manual.outbound-links.js | 2 +- priv/tracker/js/plausible.compat.exclusions.hash.manual.js | 2 +- .../plausible.compat.exclusions.hash.manual.outbound-links.js | 2 +- priv/tracker/js/plausible.compat.exclusions.local.manual.js | 2 +- ...plausible.compat.exclusions.local.manual.outbound-links.js | 2 +- priv/tracker/js/plausible.compat.exclusions.manual.js | 2 +- .../js/plausible.compat.exclusions.manual.outbound-links.js | 2 +- priv/tracker/js/plausible.compat.hash.local.manual.js | 2 +- .../js/plausible.compat.hash.local.manual.outbound-links.js | 2 +- priv/tracker/js/plausible.compat.hash.manual.js | 2 +- .../tracker/js/plausible.compat.hash.manual.outbound-links.js | 2 +- priv/tracker/js/plausible.compat.local.manual.js | 2 +- .../js/plausible.compat.local.manual.outbound-links.js | 2 +- priv/tracker/js/plausible.compat.manual.js | 2 +- priv/tracker/js/plausible.compat.manual.outbound-links.js | 2 +- priv/tracker/js/plausible.exclusions.hash.local.manual.js | 2 +- .../plausible.exclusions.hash.local.manual.outbound-links.js | 2 +- priv/tracker/js/plausible.exclusions.hash.manual.js | 2 +- .../js/plausible.exclusions.hash.manual.outbound-links.js | 2 +- priv/tracker/js/plausible.exclusions.local.manual.js | 2 +- .../js/plausible.exclusions.local.manual.outbound-links.js | 2 +- priv/tracker/js/plausible.exclusions.manual.js | 2 +- priv/tracker/js/plausible.exclusions.manual.outbound-links.js | 2 +- priv/tracker/js/plausible.hash.local.manual.js | 2 +- priv/tracker/js/plausible.hash.local.manual.outbound-links.js | 2 +- priv/tracker/js/plausible.hash.manual.js | 2 +- priv/tracker/js/plausible.hash.manual.outbound-links.js | 2 +- priv/tracker/js/plausible.local.manual.js | 2 +- priv/tracker/js/plausible.local.manual.outbound-links.js | 2 +- priv/tracker/js/plausible.manual.js | 2 +- priv/tracker/js/plausible.manual.outbound-links.js | 2 +- tracker/package-lock.json | 1 - tracker/src/plausible.js | 4 ++++ 35 files changed, 37 insertions(+), 33 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 46a5ece9a..43d6cc4bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file. ### Added - Data exported via the download button will contain CSV data for all visible graps in a zip file. - JSON API has renamed some metric items to be more clear and match the CSV API output. +- The `u` option can now be used in the `manual` extension to specify a URL when triggering events. ### Fixed - Fixes database error when pathname contains a question mark diff --git a/priv/tracker/js/plausible.compat.exclusions.hash.local.manual.js b/priv/tracker/js/plausible.compat.exclusions.hash.local.manual.js index 7c43016d9..522441704 100644 --- a/priv/tracker/js/plausible.compat.exclusions.hash.local.manual.js +++ b/priv/tracker/js/plausible.compat.exclusions.hash.local.manual.js @@ -1 +1 @@ -!function(){"use strict";var e,t,n,r=window.location,o=window.document,i=window.localStorage,l=o.getElementById("plausible"),w=l.getAttribute("data-api")||(e=l.src.split("/"),t=e[0],n=e[2],t+"//"+n+"/api/event"),p=i&&i.plausible_ignore,s=l&&l.getAttribute("data-exclude").split(",");function d(e){console.warn("Ignoring Event: "+e)}function a(e,t){if(!(window._phantom||window.__nightmare||window.navigator.webdriver||window.Cypress)){if("true"==p)return d("localStorage flag");if(s)for(var n=0;n