Back to Actions

Updated on Jun 08, 2024


This code is triggered by the Javascript tracker when the control code (nonce) sent by the browser doesn’t match the expected value for the given data.

Here’s a simplified explanation of what the code does:

// Make sure that the control code is valid
list(self::$data_js['id'], $nonce) = explode('.', self::$data_js['id']);
if ($nonce !== md5(self::$data_js['id'].self::$options['secret'])){
	self::$stat[ 'id' ] = -103;
	self::_set_error_array( __( 'Invalid data signature. Try clearing your WordPress cache.', 'wp-slimstat' ) );

How it works

  1. The tracker receives data from the browser, which includes an ID and a special code (nonce) to verify the data’s authenticity.
  2. The code splits the ID into two parts: the actual ID and the nonce.
  3. It then checks if the nonce is valid by comparing it to a generated code using the ID and a secret key.

What happens if the data is invalid

  1. The plugin triggers an action named ‘slimstat_track_exit_103’.
  2. It sets the stat ID to -103, indicating an error.
  3. It records an error message: “Invalid data signature. Try clearing your WordPress cache.”
  4. It saves this error in the plugin’s options.
  5. Finally, it stops the process and returns “-103.0” to the browser.

Why this matters

This check ensures that the data received is genuine and hasn’t been modified. If the data is invalid, it could mean someone is trying to send fake data or there’s a caching issue with your WordPress site.


If you see this error, try clearing your WordPress cache as mentioned in the error message. This can often resolve issues caused by outdated or conflicting cached data.