selfhosting icon indicating copy to clipboard operation
selfhosting copied to clipboard

where is swetrix.js located in the self hosted version?

Open rolikeusch opened this issue 2 years ago • 4 comments

i installed the self hosted version, but when i click on the link to get the javascript tracking code i see the following output:

<script src="https://swetrix.org/swetrix.js" defer></script>
<script>
  document.addEventListener('DOMContentLoaded', function() {
    swetrix.init('xxxxxxxxxxxxxx')
    swetrix.trackViews()
  })
</script>

<noscript>
  <img
    src="https://api.swetrix.com/log/noscript?pid= xxxxxxxxxxxxxx"
    alt=""
    referrerpolicy="no-referrer-when-downgrade"
  />
</noscript>

where can I set my own url? and where is the swetrix.js located in the self hosted version?

rolikeusch avatar Aug 22 '24 16:08 rolikeusch

Hi @rolikeusch, the swetrix.js is not a part of standard selfhosted releases and can be:

  1. Installed from our Cloud CDN (https://swetrix.org/swetrix.js) which will redirect you to https://cdn.jsdelivr.net/gh/Swetrix/swetrix-js@latest/dist/swetrix.js (if you want, you can replace @latest in that URL to any specific version from swetrix-js releases).
  2. Instaled from NPM via npm i swetrix.

In both of these scripts you can configure your selfhosted API URL using apiURL parameter of the swetrix.init function, see more docs on this here: https://docs.swetrix.com/swetrix-js-reference

I hope this helps, let me know if you have any more questions.

Blaumaus avatar Aug 23 '24 01:08 Blaumaus

You can also proxy our Swetrix.JS CDN via your domain if needed.

Blaumaus avatar Aug 23 '24 01:08 Blaumaus

thanks for the information. I am using the Docker version, it looks like this will be a little more complicated.

rolikeusch avatar Aug 23 '24 05:08 rolikeusch

thanks for the information. I am using the Docker version, it looks like this will be a little more complicated.

Do you have instructions on how you did it?

slavickox avatar Nov 14 '24 04:11 slavickox