Swetrix / selfhosting

37 stars 8 forks source link

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

Closed rolikeusch closed 1 month ago

rolikeusch commented 1 month ago

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?

Blaumaus commented 1 month ago

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 commented 1 month ago

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

rolikeusch commented 1 month ago

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