How to Automatically and Regularly Empty the jinbound_tracks Table

Why you need to regularly empty #__jinbound_tracks table

Your Joomla database tables store various information. It could be content items, such as content articles, created by you manually.

It could also be some tracking data, such as the IP address of a visitor and the visited URL. Such data gets created automatically, without your involvement.

The image below displays a typical record automatically created in the ##__jinbound_tracks table.

jinbound tracks table fields

This record has been created after a visitor requested the "Sample Sites" page.

The ##_jinbound_tracks table will store such records for both human visitors and bots. On a busy site, the ##__jinbound_tracks table may easily grow to over a million records. That's why you need to regularly empty it. 

How to automatically and regularly empty #__jinbound_tracks table

The best way to empty the ##__jinbound_tracks table is creating a specific SQL cron command under your hosting control panel. 

If this is a new term for you, here is what a cron is according to Wikipedia:

The software utility cron is a time-based job scheduler in Unix-like computer operating systems. People who set up and maintain software environments use cron to schedule jobs (commands or shell scripts) to run periodically at fixed times, dates, or intervals...

Wikipedia, Cron.

Let's take a look at how to create an SQL cron command using hosting control panel "CPanel". 

  • Contact your host and ask them for the following information:
    • Your Joomla site database name
    • Your Joomla site database prefix
    • Your Joomla site database username
    • Your Joomla site database password
    • Path to your MySQL.
  • Login to your CPanel.
  • Locate the "Cron Jobs" icon:

find cron jobs icon

  • You will be taken to the "Cron Jobs" screen.
  • Locate the "Cron Email" section and enter your email address into the "Email" field. Every time your cron job runs, you will receive a notification at this email:

enter email address

  • Scroll down to the "Common Settings" section.
  • Click "- Common Settings -" and from the drop-down select how often you would like to empty the ##_jinbound_tracks table. We recommend doing this once a month:

select once per month

  • Notice that once you clicked on "Once Per Month(0 0 1 * *", all the time-related fields got automatically filled in. Leave them intact or finetune the timing:

fine tune all the time related fields

  • Enter into the "Command:" field the following command:

/path/to/your/mysql -u[your-database-username] -p[your-database-password] -hlocalhost -D[your-database-name] -e"TRUNCATE TABLE [your-database-prefix]_jinbound_tracks"

click add new cron job

  • Click "Add New Cron Job". For a few seconds, you will see the message saying that cPanel successfully added a new cron job. You will also see the new cron job listed in the "Current cron jobs" section:

cron job created

Excellent! From now on, this cron job will be automatically emptying your ##_jinbound_tracks table twice a day.