Skip to content

Web Analytics

Installation

You can use Palzin Track Web SDK by adding the following script tag to your HTML file to install the web library. Please don't forget to update the TOKEN and PROJECT ID values with your own values.

<script 
    async="true" 
    src="https://palzin.live/rel/1.0.7/pt.js" 
    data-project-id="<YOUR_PROJECT_ID>" 
    data-api-key="<YOUR_PUBLIC_API_TOKEN>" 
    data-auto-track="true"
    data-cache="true"
    data-domains="mywebsite.com,mywebsite2.com"
></script>
<script 
    async="true" 
    src="https://palzin.live/rel/1.0.7/pt.js" 
    data-project-id="<YOUR_PROJECT_ID>" 
    data-api-key="<YOUR_PUBLIC_API_TOKEN>" 
    data-auto-track="true"
    data-cache="true"
    data-domains="mywebsite.com,mywebsite2.com"
></script>

Palzin Track provides several properties that allow you to configure its behavior.

data-project-id and data-api-key (required)

By default, Palzin Track will send data to wherever the script is located. You can override this to send data to another project with its appropriate API TOKEN. You will need to change the value of data-project-id and data-api-key.

Usage:

html
<script
    defer
    src="https://palzin.live/rel/1.0.7/pt.js"
    data-project-id="<YOUR_PROJECT_ID>" 
    data-api-key="<YOUR_PUBLIC_API_TOKEN>"   
></script>
<script
    defer
    src="https://palzin.live/rel/1.0.7/pt.js"
    data-project-id="<YOUR_PROJECT_ID>" 
    data-api-key="<YOUR_PUBLIC_API_TOKEN>"   
></script>

data-auto-track

By default, Palzin Track tracks all pageviews and events for you automatically. You can disable this behavior and track events yourself using the Tracker Functions.

Usage:

html
<script
    defer
    src="https://palzin.live/rel/1.0.7/pt.js"
    data-project-id="<YOUR_PROJECT_ID>" 
    data-api-key="<YOUR_PUBLIC_API_TOKEN>"   
    data-auto-track="false"
></script>
<script
    defer
    src="https://palzin.live/rel/1.0.7/pt.js"
    data-project-id="<YOUR_PROJECT_ID>" 
    data-api-key="<YOUR_PUBLIC_API_TOKEN>"   
    data-auto-track="false"
></script>

data-cache

If you get a lot of pageviews from the same user, for example in a forum website, you can cache some data to improve the performance of the tracking script.

Note: This will use session storage so you may need to inform your users._

Usage:

html
<script
  defer
    src="https://palzin.live/rel/1.0.7/pt.js"
    data-project-id="<YOUR_PROJECT_ID>" 
    data-api-key="<YOUR_PUBLIC_API_TOKEN>"
    data-cache="false"
></script>
<script
  defer
    src="https://palzin.live/rel/1.0.7/pt.js"
    data-project-id="<YOUR_PROJECT_ID>" 
    data-api-key="<YOUR_PUBLIC_API_TOKEN>"
    data-cache="false"
></script>

data-domains

If you want the tracker to only run on specific domains, you can add them to your tracker script. This is a comma delimited list of domain names. Helps if you are working in a staging/development environment.

Usage:

html
<script
  defer
    src="https://palzin.live/rel/1.0.7/pt.js"
    data-project-id="<YOUR_PROJECT_ID>" 
    data-api-key="<YOUR_PUBLIC_API_TOKEN>"
    data-domains="mywebsite.com,mywebsite2.com"
></script>
<script
  defer
    src="https://palzin.live/rel/1.0.7/pt.js"
    data-project-id="<YOUR_PROJECT_ID>" 
    data-api-key="<YOUR_PUBLIC_API_TOKEN>"
    data-domains="mywebsite.com,mywebsite2.com"
></script>

Google Tag Manager

Google Tag Manager will strip the attributes from the tracker, so you can bypass this by using the format below.

<script>
  (function () {
    var el = document.createElement('script');
    el.setAttribute('src', 'https://palzin.live/rel/1.0.7/pt.js');
    el.setAttribute('data-project-id', '<YOUR_PROJECT_ID>');
    el.setAttribute('data-api-key', '<YOUR_PUBLIC_API_TOKEN>');
    document.body.appendChild(el);
  })();
</script>
<script>
  (function () {
    var el = document.createElement('script');
    el.setAttribute('src', 'https://palzin.live/rel/1.0.7/pt.js');
    el.setAttribute('data-project-id', '<YOUR_PROJECT_ID>');
    el.setAttribute('data-api-key', '<YOUR_PUBLIC_API_TOKEN>');
    document.body.appendChild(el);
  })();
</script>

Note: Please ensure that your token is set to "Public" and its roles are limited to the project you're tracking.