Blog

For solo engineers, but not only.

Beyond Google Analytics: Embrace Privacy with Ackee on Vercel

February 16, 2024Lev Gelfenbuim24 min. read

In an age where digital privacy is more than just a buzzword, it's a fundamental user expectation, the tools we choose to analyze web traffic speak volumes about our commitment to respecting visitor privacy. Traditional analytics platforms, while powerful, often come at the cost of this privacy, collecting more data than they need and sharing it in ways that might not align with our values or our users' expectations.

Ackee, a beacon of hope for those of us seeking a balance between gaining insights into our website's performance and upholding the privacy rights of our audience.

Ackee distinguishes itself as a privacy-first, open-source analytics tool designed to offer website owners and developers a way to track website statistics without compromising on the privacy of their visitors. This approach not only aligns with the stringent requirements of privacy laws like GDPR but also resonates with a growing segment of internet users wary of traditional analytics' invasive data collection practices.

The aim of this post is not just to introduce you to Ackee as a viable, privacy-respecting alternative to Google Analytics but to walk you through the process of setting it up on Vercel—a platform known for its developer-friendly deployment and high-performance hosting solutions. Whether you're a seasoned developer or just dipping your toes into the world of web analytics, this guide is designed to demystify the process of self-hosting Ackee on Vercel, ensuring that you can take control of your web analytics in a way that respects your visitors' privacy and complies with global data protection regulations.

Understanding Ackee

Ackee is an open-source, self-hosted analytics tool that prioritizes user privacy without compromising on the depth and usefulness of the insights it provides. Named after the vibrant fruit, it offers a refreshing alternative to the often invasive nature of traditional web analytics. By focusing on anonymized data collection, Ackee ensures that website owners can understand their traffic and user engagement without encroaching on individual privacy.

Key Features and Benefits
  • Privacy-Centric Data Collection: Ackee does not track full IP addresses or use cookies, making it inherently compliant with strict privacy laws like GDPR and CCPA. This approach respects the anonymity of your visitors while still providing valuable insights.
  • Simple, Intuitive Interface: Designed with usability in mind, Ackee offers a clean and straightforward dashboard that highlights essential metrics, such as page views, unique visitors, and bounce rates, without overwhelming the user with excessive data.
  • Self-Hosted and Open Source: The self-hosting aspect of Ackee means you have full control over your data. Being open source also invites a community of developers to contribute to its ongoing improvement, ensuring that the tool evolves to meet user needs while maintaining its core privacy-focused ethos.
  • Event Tracking: Ackee allows for the tracking of custom events, enabling more detailed analysis of how users interact with your website beyond mere page views. This feature is implemented in a way that remains respectful of user privacy.
Upholding Privacy and Compliance

Ackee's architecture is built from the ground up with privacy as its cornerstone. It achieves a delicate balance between gathering useful analytics and respecting the digital rights of individuals. By anonymizing and minimizing the data collected, Ackee not only adheres to privacy laws but also aligns with the ethical considerations of web stewardship in the modern age.

In an online world where user data is often exploited for commercial gain, Ackee represents a shift towards more respectful analytics practices. It demonstrates that it is possible to gain insights into website performance and user behavior without sacrificing the privacy of those who visit our digital spaces.

Why Choose Self-Hosting on Vercel?

The choice of platform is as crucial as the tools we deploy on it. When it comes to self-hosting a privacy-centric analytics tool like Ackee, Vercel stands out for several compelling reasons:

Seamless Deployment and Scalability

Vercel is renowned for its exceptional ease of use and seamless deployment processes, particularly for JavaScript projects. With just a few clicks or a single command, you can deploy your Ackee instance to a global infrastructure that's optimized for performance and scalability. This simplicity is invaluable for developers looking to minimize setup time and effort without sacrificing control over their analytics environment.

Optimized for Modern Web Projects

Vercel is designed with modern web applications in mind, offering first-class support for Next.js, Node.js, and other JavaScript frameworks. This makes it an ideal environment for hosting Ackee, ensuring that the analytics platform benefits from the latest in web technology and performance optimizations. The synergy between Vercel's hosting capabilities and Ackee's lightweight architecture provides a robust, efficient analytics solution that doesn't bog down your site or server.

Commitment to Privacy and Security

Vercel places a high emphasis on privacy and security, offering features like HTTPS by default, automatic SSL, and DDoS protection. These features complement Ackee's privacy-first approach, creating a hosting environment that safeguards both your analytics data and your users' privacy. By choosing Vercel, you're not just getting a hosting provider; you're partnering with a platform that shares your commitment to respecting user privacy.

Developer-Friendly Tools and Ecosystem

Vercel offers an array of developer-friendly tools and integrations, making it easy to manage your projects, monitor performance, and troubleshoot issues. The platform's comprehensive CLI and API support further streamline the deployment and management of applications like Ackee. Additionally, Vercel's vibrant ecosystem and community provide ample resources, documentation, and support to help you maximize your use of Ackee.

Global CDN and Performance Optimization

At the heart of Vercel's offering is its global Content Delivery Network (CDN), which ensures that your Ackee analytics dashboard loads quickly and reliably, regardless of where your visitors are located. This global reach, combined with automatic performance optimizations, means that your analytics platform will be as fast and responsive as the rest of your web presence, enhancing the overall user experience.

Prerequisites for Hosting Ackee on Vercel

Before diving into the technicalities of deploying Ackee on Vercel, it's essential to ensure that you have everything needed to make the process as smooth and efficient as possible. This section outlines the prerequisites for hosting Ackee on Vercel, preparing you for a successful setup of your privacy-first analytics platform.

1. Vercel Account

First and foremost, you'll need an account with Vercel. If you haven't already, sign up on the Vercel website. The platform offers a free tier that's perfect for getting started with Ackee, with the option to upgrade as your needs grow.

2. Domain Name

While not strictly necessary for deployment, having a domain name for your Ackee instance helps with accessibility and professionalism. If you plan to use Ackee across multiple projects, a dedicated domain or subdomain (e.g., analytics.yourdomain.com) makes it easy to access and share your analytics dashboard.

3. Node.js and npm/yarn

Ackee is built with Node.js, so you'll need to have Node.js installed on your local machine to run certain commands or make modifications to the Ackee instance. Along with Node.js, having npm or yarn for package management will be necessary for installing dependencies or running build scripts.

4. MongoDB Database

Ackee uses MongoDB to store analytics data. You'll need access to a MongoDB database, which can be hosted locally, on a VPS, or through a managed database service like MongoDB Atlas. If you choose a service like MongoDB Atlas, ensure you have created an account and set up a database cluster that Ackee can connect to.

5. Basic Knowledge of Git

Since you'll likely be cloning the Ackee repository and potentially making customizations, a basic understanding of Git and GitHub is helpful. This knowledge will also assist in deploying your Ackee instance to Vercel through Git integration.

6. Familiarity with Environment Variables

Ackee requires the configuration of environment variables for things like database connection strings and other settings. Understanding how to set and manage environment variables in Vercel is crucial for a secure and functional deployment.

Deploying Ackee on Vercel

Deploying Ackee on Vercel is a straightforward process that combines the simplicity of Vercel's deployment platform with the robustness of Ackee.

Step 1: Prepare Your Ackee Instance

Before deploying Ackee to Vercel, you need to have your Ackee instance ready. If you haven't already, clone the Ackee repository from GitHub to your local machine. You can find the official Ackee repository URL on the Ackee GitHub page. Once cloned, navigate into the Ackee directory.

1git clone https://github.com/electerious/Ackee.git
2cd Ackee
Step 2: Configure Ackee

Before deploying, you must configure your Ackee instance to connect to your MongoDB database and set other necessary environment variables. Create a .env file in the root of your Ackee directory and add your MongoDB connection string and any other relevant configurations as specified in the Ackee documentation.

1ACKEE_MONGODB=mongodb+srv://your_mongodb_connection_string
2ACKEE_USERNAME=admin
3ACKEE_PASSWORD=password
4ACKEE_ALLOW_ORIGIN=https://your_domain
Step 3: Deploy to Vercel

The next step is to deploy it to Vercel. If you haven't linked your GitHub (or other git providers) account with Vercel, do so now by following the instructions on the Vercel dashboard.

  • Push Your Ackee Instance to a Git Repository: If your Ackee instance isn't already in a Git repository, initialize one, commit your changes, and push it to GitHub, GitLab, or Bitbucket.
1git init
2git add .
3git commit -m "Initial commit"
4git remote add origin <your-git-repository-url>
5git push -u origin master
  • Import Your Project on Vercel: Go to the Vercel dashboard, click on "New Project", and select the repository you just pushed. Vercel will automatically detect that it's a Node.js project.
  • Configure Environment Variables in Vercel: During the import process, Vercel will ask you to configure environment variables. Enter the same variables you defined in your .env file.
  • Deploy: After configuring your environment variables, proceed with the deployment. Vercel will build and deploy your Ackee instance, providing you with a URL to access your Ackee dashboard.
Step 4: Verify Your Deployment

Once deployed, visit the URL provided by Vercel to access your Ackee dashboard. Log in with the username and password you set to ensure everything is working as expected. You should see the Ackee dashboard, ready for you to add your websites and start tracking analytics.

Integrating Ackee with Your Website

Once you have successfully deployed Ackee on Vercel, the next step is to integrate it with your website to start tracking analytics data. This process involves adding a small snippet of code to your site, allowing Ackee to collect anonymized data without compromising your visitors' privacy. Here's how to seamlessly integrate Ackee with your website, ensuring you can monitor user interactions while upholding the highest standards of data protection.

Step 1: Locate Your Ackee Domain and ID

After deploying Ackee, you will have a unique URL for your Ackee dashboard and a domain ID for each website you wish to track. The domain ID is a unique identifier that links your website to its corresponding data within Ackee.

  1. Log into your Ackee dashboard.
  2. Navigate to "Domains" and find or add your website. Once added, Ackee will provide you with a domain ID.
Step 2: Add the Ackee Tracking Script

Ackee provides a JavaScript tracking script that you need to include on your website. This script is responsible for sending anonymized data back to your Ackee instance.

  1. Within your Ackee dashboard, locate the tracking script provided for your domain. It will look something like this:
1<script async src="https://your-ackee-instance.com/tracker.js" data-ackee-server="https://your-ackee-instance.com" data-ackee-domain-id="YOUR_DOMAIN_ID"></script>
  1. Replace https://your-ackee-instance.com with your actual Ackee instance URL and YOUR_DOMAIN_ID with the domain ID provided by Ackee.
  2. Place this script in the <head> or <body> tag of your HTML, or integrate it into your site's template if you're using a CMS or a web framework. For dynamic websites or single-page applications, ensure the script is executed every time a page is loaded or a route is changed.
Utilizing ackee-tracker for Advanced Tracking

Hosted on GitHub at electerious/ackee-tracker, this library provides advanced functionality for developers looking to dive deeper into website analytics while maintaining a privacy-first approach. Here's how you can leverage the ackee-tracker to enhance your website's integration with Ackee:

First, you'll want to include ackee-tracker in your project. If you're using a modern JavaScript framework or building a single-page application, you can install it via npm or yarn:

1npm install ackee-tracker
2# or
3yarn add ackee-tracker

Once installed, you can import ackee-tracker into your JavaScript file and initialize it with your Ackee server URL and domain ID:

1import ackeeTracker from 'ackee-tracker';
2
3const instance = ackeeTracker.create({
4    server: 'https://your-ackee-instance.com',
5    domainId: 'YOUR_DOMAIN_ID'
6});
7
8instance.record();

ackee-tracker provides several advanced features that allow for more detailed analytics tracking, including:

  • Event Tracking: Track custom events on your website, such as button clicks, form submissions, or any other interactions. This enables you to gather detailed insights into how users engage with your content.
1instance.action('513a082c-2cd5-4939-b417-72da2fe1761d', {
2	key: 'Checkout',
3	value: 9.99
4})
  • Opt-In Tracking: ackee-tracker supports opt-in tracking mechanisms, allowing users to consent to analytics tracking. This feature is crucial for compliance with GDPR and other privacy regulations.
1if (userConsentsToTracking) {
2    instance.record('hd11f820-68a1-11e6-8047-79c0c2d9bce0');
3}
  • Ignoring Localhost: For developers, ackee-tracker offers the option to ignore visits from localhost, ensuring that development traffic doesn't skew your analytics data.
1const instance = ackeeTracker.create('https://ackee.example.com', {
2	ignoreLocalhost: true
3});
Step 3: Verify Integration

After adding the tracking script to your website, visit your site to trigger some page views. Then, check your Ackee dashboard to see if the visits are being recorded. It might take a few minutes for data to appear in your dashboard. If you see the data, congratulations! Your website is now successfully integrated with Ackee, and you can start analyzing your site's traffic without infringing on user privacy. If data does not appear, double-check the tracking script for any typos in the URL or domain ID. Also, ensure your web browser is not blocking the script with an ad blocker or privacy tools.

Best Practices for Privacy-First Analytics

Here are key best practices to consider when deploying privacy-first analytics on your website:

Be Transparent with Your Users

Transparency is the cornerstone of privacy-first analytics. Clearly communicate to your visitors how you collect and use data. This can be achieved through a comprehensive privacy policy that details the use of analytics tools, the type of data collected, and the purpose of this data collection. Additionally, consider using a consent management platform (CMP) to obtain explicit consent from users in regions where this is required by law.

Minimize Data Collection

Practice data minimization by only collecting the data you need. Ackee is designed to collect anonymized data without tracking individual users across the web, which is a great start. Evaluate your analytics goals and adjust your data collection settings to avoid gathering unnecessary information. This approach not only respects user privacy but also simplifies compliance with data protection laws.

Ensure Data Security

Protect the data you collect by implementing robust security measures. This includes securing your Ackee instance and database with strong passwords, encryption, and regular security updates. If you're using a managed database service, choose providers that offer high security standards and compliance with privacy regulations.

Regularly Review Compliance

Data protection laws and regulations are constantly evolving. Regularly review your analytics practices and privacy policies to ensure they remain compliant with the latest laws, such as GDPR in Europe and CCPA in California. This may involve adjusting how you collect consent or manage data.

Educate Your Audience

Use your platform to educate your visitors about the importance of privacy online. By explaining why you've chosen a privacy-first analytics tool and how it differs from more invasive options, you can raise awareness about digital privacy and encourage a culture of respect and transparency.

Opt for Ethical Analytics Partners

When choosing analytics tools and partners, prioritize those that share your commitment to privacy and ethical data practices. This extends beyond analytics to all third-party services you might use, ensuring that your entire web ecosystem respects user privacy.

Enable Opt-Out Options

Provide clear options for users to opt-out of data collection. This respects user autonomy and gives them control over their personal information. Make sure the opt-out process is straightforward and accessible from your website.

Conclusion

Embracing privacy-first analytics with Ackee on Vercel represents a significant step towards ethical web analytics. By deploying Ackee, you've chosen a path that respects user privacy and aligns with the increasing global emphasis on data protection. This journey not only enhances your website's trustworthiness but also sets a standard for how analytics should be approached in a privacy-conscious world.

Throughout this guide, we've explored the importance of privacy-first analytics, the advantages of self-hosting Ackee on Vercel, and the practical steps required to make this a reality. From setting up your environment to integrating Ackee with your website, each phase was designed to empower you with the tools and knowledge to navigate the analytics landscape responsibly.

As you move forward, remember that the deployment of Ackee is not just a technical achievement but a commitment to your users' rights to privacy. The best practices outlined serve as a reminder of the ongoing responsibilities that come with handling analytics data. By being transparent, minimizing data collection, and continually reviewing compliance, you contribute to a safer, more respectful digital environment.

The integration of Ackee into your website is just the beginning. The insights gathered can drive informed decisions, enhance user experience, and improve website performance, all while maintaining the highest standards of privacy. As you harness these analytics, consider the broader impact of your choices and the role you play in shaping a privacy-respecting internet.

In conclusion, the shift towards privacy-first analytics is more than a trend; it's a necessary evolution in how we collect and analyze web data. By choosing Ackee and deploying it on Vercel, you're at the forefront of this change, championing user privacy and ethical data practices. Let's continue to lead by example, fostering a web ecosystem where privacy is not just valued but prioritized.

Additional Resources

To further enhance your understanding and capabilities with privacy-first analytics and the technical intricacies of deploying and utilizing Ackee on Vercel, a wealth of resources is available at your fingertips. Whether you're looking to deepen your technical knowledge, stay abreast of privacy laws, or explore alternative analytics solutions, the following resources provide valuable insights and guidance.

  • Official Ackee Documentation: The best place to start for anyone looking to install, configure, or customize Ackee. It offers comprehensive guides, configuration options, and troubleshooting tips. Ackee on GitHub
  • Vercel Documentation: Offers detailed instructions on deploying applications, managing projects, and optimizing performance on the Vercel platform. Vercel Documentation
  • General Data Protection Regulation (GDPR): The official site for GDPR offers insights into compliance, rights, and obligations under European law. GDPR Official Website
  • California Consumer Privacy Act (CCPA): A resource for understanding the specifics of CCPA, offering guidance for businesses and rights for consumers. CCPA Information
  • Electronic Frontier Foundation (EFF): Provides articles and resources on digital privacy, including how to protect user data and navigate privacy laws. EFF's Privacy Posts
  • International Association of Privacy Professionals (IAPP): Offers resources, research, and professional development opportunities in the field of privacy. IAPP Resources
  • Reddit: Subreddits like r/webdev and r/privacy offer community advice, discussions, and insights on web development and digital privacy.
Alternative Privacy-First Analytics Tools

For those interested in exploring other analytics solutions that prioritize user privacy, the following platforms offer various features and focuses:

  • Plausible Analytics: A lightweight, open-source alternative that provides simple and privacy-friendly web analytics. Plausible Website
  • Fathom Analytics: Offers simple, cookie-free tracking for bloggers and businesses focused on privacy. Fathom Website
  • Simple Analytics: Focuses on straightforward analytics without cookies and with full compliance with privacy laws. Simple Analytics Website

Article last update: February 22, 2024

Webdev
Privacy
Analytics
Vercel