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.
  • Add New Domain
  • 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:
  1. Drupal in index.php
  2. Joomla in index.php
  3. WordPress in wp-config.php
  4. OpenCart in index.php
  5. PunBB in index.php
  6. FluxBB in index.php
  7. 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:
  1. Laravel in public/index.php
  2. CodeIgniter in index.php
  3. CakePHP in config/config.php
  • For information regarding visitor statistics, you can go to the Analytics page for details.