Closed shinyzhu closed 3 months ago
i get you mind. the best way is only inject track code in production build.
but i think we can ignore localhost request and add domain only checkbox in website config.
i will do it later. thanks for your suggestion
It's already supported this after doing some discovery in the code. :D
Here is the solution:
You just put your tracking domains into the data-domains
attribute of the tracker script.
<script async defer src="your-tracker.js" data-website-id="your-id" data-domains="yourname.com,www.yourname.com"></script>
Then it won't send payload to server when running on localhost
or any different domains.
ref: https://github.com/msgbyte/tianji/blob/master/src/tracker/index.js#L26
Oh thanks for your invest, i will add it into document
I've been using tianji for a while.
Sometimes I need to develop and run the site locally but it tracked the visits that I don't need.
I'd like to request a feature to config a domain list to track.
Great thanks :)