# Simple Analytics

> Adds the cookie-free Simple Analytics script to your public pages. No tracking ID is needed: data is matched to the domain you added in Simple Analytics.

- Type: PHP
- Runs: Frontend only
- Category: [Analytics & Tracking](https://wpide.com/library/category/analytics/)
- Tags: simple-analytics, analytics, privacy, cookieless
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/analytics-simple-analytics/

## Code

```php
add_action( 'wp_footer', function () {
    $enabled = false; // Set to true once your domain is added in Simple Analytics.

    if ( ! $enabled || current_user_can( 'edit_posts' ) ) {
        return;
    }

    echo "<script async src=\"https://scripts.simpleanalyticscdn.com/latest.js\"></script>\n";
} );
```

## Notes

Add your domain in the Simple Analytics dashboard first. Set $enabled to true to start loading the script.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Simple Analytics" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
