define custom element for matomo tracking
This commit is contained in:
parent
fcca45edeb
commit
a638eba7c7
4 changed files with 21 additions and 3 deletions
|
@ -10,6 +10,7 @@ class Header extends HTMLElement {
|
|||
<h1>${pageTitle}</h1 >
|
||||
</div >
|
||||
</div >
|
||||
<jl-matomo></jl-matomo>
|
||||
<div class="header-separator header-separator-bottom " >
|
||||
<svg xmlns = "http://www.w3.org/2000/svg" viewBox = "0 0 1000 100" preserveAspectRatio = "none" >
|
||||
<path class="svg-white-bg" d = "M737.9,94.7L0,0v100h1000V0L737.9,94.7z" ></path >
|
||||
|
@ -17,7 +18,7 @@ class Header extends HTMLElement {
|
|||
</div >
|
||||
</div >
|
||||
<jl-main_menu id = "mainMenu"></jl-main_menu>
|
||||
</header >
|
||||
</header>
|
||||
`;
|
||||
}
|
||||
}
|
||||
|
|
16
js/customElements/matomo.js
Normal file
16
js/customElements/matomo.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
class Matomo extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
this.generateTrackImg();
|
||||
}
|
||||
async generateTrackImg(){
|
||||
let trackURL = await (await fetch("/API/config.php?name=trackURL")).text()
|
||||
this.innerHTML = `
|
||||
<!-- Matomo Image Tracker-->
|
||||
<img referrerpolicy="no-referrer-when-downgrade" src="${trackURL}" style="border:0" alt="" />
|
||||
<!-- End Matomo -->
|
||||
`;
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define("jl-matomo", Matomo);
|
|
@ -16,3 +16,4 @@ require("./customElements/contactMailButton");
|
|||
require("./customElements/header");
|
||||
require("./customElements/mainMenu");
|
||||
require("./customElements/footer");
|
||||
require("./customElements/matomo");
|
|
@ -8,7 +8,7 @@ switch ($configValue){
|
|||
echo($sitekey);
|
||||
break;
|
||||
case "trackURL":
|
||||
echo($trackurl);
|
||||
echo($trackURL);
|
||||
break;
|
||||
default:
|
||||
echo("notFound");
|
||||
|
|
Loading…
Reference in a new issue