M
O
O
N
I
T
O
Integrate Analytics API with PHP Applications (Using Moonito PHP Library)
Here is the documentation guide on integrating Analytics API into your PHP application or website. In this case, we assume that you have a PHP-based website application that you have uploaded to your server.
- First, sign up for the domain you want to protect and learn about its visitors on the Analytics page.
- Download Moonito PHP Library and extract the contents of the .zip file.
- Upload the
lib
directory and its contents. - Modify the configuration in
lib/config.php
according to your preferences.
<?php
// Put your API Public Key here
$apiPublicKey = 'Your API Public Key';
// Put your API Secret Key here
$apiSecretKey = 'Your API Secret Key';
// Protection option
// If set to 'true,' it turns on the protection
// If set to 'false,' it turns off the protection
$isProtected = true;
// Unwanted visitors redirection
// Leave it blank for default error response
$unwantedVisitorRedirect = 'https://google.com';
- Open the PHP file you want to secure, after
<?php
at the top of the file, include the following code.
include_once("lib/detector.php");
- To configure the connection for various Content Management Systems (CMS), follow the specified paths relative to the root directory of the site:
- Drupal in
index.php
- Joomla in
index.php
- WordPress in
wp-config.php
- OpenCart in
index.php
- PunBB in
index.php
- FluxBB in
index.php
- MyBB in
inc/config.php
- To configure the connection for various PHP Framework, follow the specified paths relative to the root directory of the site:
- Laravel in
public/index.php
- CodeIgniter in
index.php
- CakePHP in
config/config.php
- For information regarding visitor statistics, you can go to the Analytics page for details.