Do you want to block IP addresses in Lite Analytics? Here is how:
- Install WP Code plugin
- Create a “Universal snippet”. Make sure its Universal and not PHP.
- Run the snippet everywhere
- Insert the complete code snippet shown below
- Change xx.xx.xx.xx to the ip addresse(s) of the blocked ip addresses. If you only have one IP address, just use one array item. Single quotes are needed around ip addresses.
- Change bbbbbb in the script below to the default host provided by liteanalytics website
Code to use:
<?php $user_ip = $_SERVER['REMOTE_ADDR']; $blocked_ips = array('xx.xx.xx.xx', 'xx.xx.xx.xx'); // Replace with your list of blocked IP addresses if (!in_array($user_ip, $blocked_ips)): ?> <script defer async data-host="bbbbbb" src="https://liteanalytics.com/lite.js"></script> <?php endif; ?>
If you only have one IP address to block, then replace line 3 above with this:
$blocked_ips = array('xx.xx.xx.xx');// Replace with your IP address