Lite Analytics documentation

Install script in WordPress

To enable tracking of visits and other vital website statistics, it's essential to embed the provided JavaScript code within the <head> section of your webpages.

From Lite Analytics settings section you can generate a JavaScript code specific to your domain name, which should resemble the following:

<script defer async data-host="your_domain_name_here" src="https://liteanalytics.com/lite.js"></script>

To generate a proper script for your web property, go to Lite Analytics Settings and select Get code for desired web property.

The general recommendation is to place the Lite Analytics code just before the closing </head> tag. However, you can also place it elsewhere within the <body> element if you prefer. The defer and async attributes ensure that the script loads after the rest of the page, so the loading and execution of the Lite Analytics script won't interfere with your page's loading process in any way.

WordPress integration

There are several ways to install the Lite Analytics script on your WordPress site:

1) Using theme settings

Most of the more advanced WordPress themes, such as Avada, have their own sections where you can add analytics code, like Google Analytics code or in this case Lite Analytics code.

The exact implementation varies depending on the theme. For instance, in the Avada theme, navigate to Global Options -> Advance -> Code Fields, and then add the Lite Analytics code in the Space before </head> field.

If you're having trouble identifying the appropriate location within your WordPress theme to embed the analytics code, don't hesitate to get in touch with us. We're here to help and will strive to identify a solution specifically tailored to your situation.

2) Using Header & Footer code plugin

Instead of developing our own plugin for WordPress, we recommend installing the Header & Footer Code plugin. This highly-rated plugin has more than 100,000+ active installations and can be used to include arbitrary JavaScript code on your pages, not just Lite Analytics.

After installing the plugin, insert the Lite Analytics code into the HEAD Code section.

3) Manually

If you are an experienced WordPress developer and know what you're doing, you can include the Lite Analytics code directly in your WordPress website by using Theme File Editor *

In your WordPress admin navigate to Appereance -> Theme File Editor and edit functions.php file by adding this code:

function lite_analytics_code() {
?>
<script defer async data-host="your_domain_name_here" src="https://liteanalytics.com/lite.js"></script>
<?php
}
add_action('wp_head', 'lite_analytics_code');

To generate a proper script part of this code for your web property, go to Lite Analytics Settings and select Get code for desired web property.

* Depending on your hosting provider, this option might be disabled for security reasons

@LiteAnalytics on Twitter
©2023 Lite Analytics