Add pirsch.io tracking to write.as
Write.as has the option to add custom CSS and JS to the site. Write.as has also basic tracking for the posts and how they are performing. But it is just basic tracking and only for the last 30 days. So I wanted a bit more. For private projects, I use prisch.io. Which is privacy-friendly and hosted in Germany. I will try this out. If it is not working as expected, I will remove the script.
How can you implement such a script?
First, go to your pirsch.io Dashboard and click the +
Icon on the top-right.
You will be asked between Client or Server implementation. Go to Client implementation and copy the script tag.
<script defer src="https://api.pirsch.io/pa.js"
id="pianjs"
data-code="YOUR_SITE_CODE"></script>
Now, transfer this HTML into JavaScript. Here we create a new element and add it to the document <head />
.
// Add prisch tracking --- START
const script = document.createElement('script');
script.setAttribute('id', 'pianjs');
script.setAttribute('defer', true);
script.setAttribute('src', 'https://api.pirsch.io/pa.js');
script.setAttribute('data-code', 'YOUR_SITE_CODE');
document.head.appendChild(script);
// Add prisch tracking --- END
This snipped can be added to your write.as blog. Go to your write.as Dashboard and select the Customize Button. Here is an area where you can add custom JavaScript.
Hit “Save changes” and reload your blog. The script should now be added. :)
I hope this will help someone.
25/100 of #100DaysToOffload