DENSE0

A Guide to Tracking Website Visitors

Your website is getting lots of visitors, but you are only seeing X visitors this month. Knowing the numbers might not be useful. I'll guide you on how to add analytics to your website, track more information about your website visitors, and make wise decisions based on that.

Before we begin...

The type of data you want to collect about your visitors should depend on your business goals. It's essential to determine what specific data will help you make informed decisions.

When we collect user data there are two ways we can collect their data,

  1. Automatic data collection: This method allows you to gather information without users' direct involvement, such as using their IP addresses to determine their location.

  2. Manual Data Collection: This involves directly asking your visitors to provide information, usually through forms or surveys. For example, you can request their email address, name, or feedback during their visit. This approach is more transparent and allows you to gather specific data directly from users.

Tools for Automatic Data Collection

when it comes to automatic data collection there are lots of tools available that give us basic information about the user like approximate location, region, IP and etc. One tool I'm using on my website is ipinfo. This kind of tools are helpful but if you don’t want to develop a custom solution. If that's the case, there are plenty of free and specialized tools in this area.

Google Analytics is a free tool for tracking website traffic, user demographics, and behavior. It also offers a detailed dashboard to give you insights into how visitors interact with your site. WARNING if you're concerned about data security or privacy you may want to avoid using Google Analytics. see more here https://plausible.io/blog/google-analytics-illegal.

If data privacy is a concern and you prefer hosting your own solution, you're in luck—there are several open-source tools available that allow you to have full control over your data.

  • Post Hog: provides open-source web & product analytics, session recording, feature flagging, and A/B testing that you can self-host. Get started - free.

  • Matomo: A privacy-focused alternative to Google Analytics that offers complete data ownership.

Traffic Sources tracking

Traffic source tracking helps you know from where the visitor of your website is coming. Here are a few types of traffic sources:

  • Organic Search: Visitors who find your site through search engines like Google. This is where SEO comes in—if you’re ranking well, expect more of these.

  • Direct Traffic: People who type your URL directly or have it bookmarked. High direct traffic means strong brand recognition.

  • Referral Traffic: Visitors who land on your site from links on other websites. This shows which partnerships or mentions are working.

  • Social Media Traffic: Traffic from platforms like Facebook, Instagram, or Twitter. Great for tracking the success of your social media efforts.

  • Paid Traffic: Comes from ads you’re running, like Google Ads or social media campaigns. Helps measure the effectiveness of your ad spend.

  • Email Traffic: Visitors from your email campaigns. Useful for tracking how well your emails are driving traffic.

Technical Overview:

I’m not going to implement this from scratch, but here’s a high-level overview of how you can do it.

You might be wondering, "How can we track where the user is coming from?" It’s actually pretty simple. You can use query parameters in the URL. For example, you add parameters www.example.com?utm_source=email to your link.

Once the user clicks on this link, you can capture the query parameters on the client side (in JavaScript, for instance) and then send this data to your server. From there, you can increment your database or store the information based on the value of the utm_source or any other UTM parameters you add.

if you are interested in learning you can check Linklift a simple source tracking tool I built.


Ethical Considerations

While tracking your website visitors is crucial for improving user experience and optimizing marketing efforts, it's important to always be transparent and respectful of user privacy. Make sure to inform users that their data is being collected, and give them the option to opt out if they prefer. Adhering to privacy regulations, like GDPR, and using data responsibly ensures that you're not only building trust with your audience but also protecting their rights. Always keep ethical considerations in mind to create a positive and secure environment for your users.

Congratulations on how far you’ve come! 🎉