Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

Fix old script

Uku Tahtff9f95ea18f3
diff --git a/tracker/src/p.js b/tracker/src/p.js
index 55edddcaad..c675bc409a 100644
--- a/tracker/src/p.js
+++ b/tracker/src/p.js
@@ -2,9 +2,11 @@
// with some early customers. This script uses a cookie but this was an old version of Plausible.
// Current script can be found in the tracker/src/plausible.js file
-(function(window, plausibleHost){
+(function(){
'use strict';
+ var plausibleHost = new URL(scriptEl.src).origin
+
function setCookie(name,value) {
var date = new Date();
date.setTime(date.getTime() + (3*365*24*60*60*1000)); // 3 YEARS
@@ -117,4 +119,4 @@
} catch (e) {
new Image().src = plausibleHost + '/api/error?message=' + encodeURIComponent(e.message);
}
-})(window, '<%= base_url %>');
+})();