How to track user's navigation (or footprints) path through a website

Started by thefriendlancer, 12-11-2015, 05:02:22

Previous topic - Next topic

thefriendlancerTopic starter

So we plan to track a user's activity within our website which are in PHP. What we want to know is track a unique session for a user from the time he first visits a page in our site, the pages he visited next, and visited last.

Some kind of tracking his footprint through our site. We actually have identified 2 methods:

  • using a custom PHP code
  • analytics.js

We find analytics.js too much for this (and my take more time to setup including time for our Internal Team to familiarize/learn the tool). Considering what we need is just getting the timelogs of the user's session.

So we'll most likely be going with a custom code added to each of the pages that need tracking. This script will do the following:


  • we will be pasting code snippets to pages that need tracking
  • generate a unique session ID once he lands on any of the tracked pages
  • records the activity on a database
  • create an admin dashboard to visualize each of the user's activity, just a simple UI to showing the timelogs and pages visited

That's our plan so just wondering:

Questions:


  • Is the above method acceptable?
  • Are there any other alternatives that what was described above?

Thanks in advance SEO Mastering community!
  •  


zrfragap

The method you described using custom PHP code to track user activity and generate a unique session ID is acceptable. It allows you to have more control over the tracking process and customize it according to your specific needs.

However, there are a few alternative methods you could consider:

1. Use a pre-built analytics tool: Instead of building a custom tracking system, you could use an existing analytics tool like Google Analytics or Matomo (formerly Piwik). These tools offer robust tracking capabilities and provide you with detailed insights into user behavior on your website. They also have user-friendly dashboards for visualizing data.

2. Use server log analysis: Another approach is to analyze server logs, which record all requests made to your website. By analyzing these logs, you can track user activity, pages visited, and other relevant information. This method requires parsing and processing the log files, and it may require some technical expertise.

3. Utilize web server logs: Most web servers have built-in logging functionality that can be used to track user activity. By configuring your server to log relevant data, such as the requested URLs and timestamps, you can extract the necessary information to track user sessions.

4. Implement a session management framework: If you prefer a more structured approach, you can use a session management framework like PHP's built-in session management or a third-party library like Symfony Session. These frameworks handle the creation and management of session IDs, making it easier to track user activity.


here are some additional considerations:

1. Privacy and data protection: When implementing any tracking system, it's important to ensure that you comply with applicable privacy laws and regulations. Make sure to inform your users about the tracking activities and obtain their consent if necessary.

2. Scalability and performance: Consider the potential scalability and performance implications of your tracking method. If your website experiences high traffic volumes, you may need to optimize your database queries or consider using caching mechanisms to handle the load efficiently.

3. Security: Ensure that the tracking system and the database storing user activity logs are secure. Implement proper authentication and authorization mechanisms to protect sensitive user data from unauthorized access.

4. Real-time tracking: If you require real-time tracking of user activity, consider using technologies like WebSockets or server-sent events to push updates to the admin dashboard without the need for periodic polling.

5. Error handling and logging: Implement robust error handling and logging mechanisms to capture any errors that may occur during the tracking process. This will help you troubleshoot issues and maintain a reliable tracking system.

Remember, while building a custom tracking system gives you more control, it also requires ongoing maintenance and updates. Alternatively, using existing analytics tools can save time and effort in setup but may have limitations in terms of customization. Consider these factors and choose the method that best aligns with your goals and resources.
  •