1. Start
  2. Requirements
  3. Installation
  4. Facebook API
  5. Customization
    1. Basic Settings
    2. SEO Settings
    3. EU Cookie Law
    4. Cron Jobs
  6. API Documentation
  7. Before buy

Social Links Analytics

Documentation


Thank you for purchasing this item. If you have have some problems, please contact me: roman.codecanyon@gmail.com


Requirements


Installation


  1. Upload files to your web server or hosting.
  2. Open /root/config/db.php and set mysql settings
  3. Import socialstat.sql in mysql
  4. Enjoy

Note. If your main index.php file located not in the root folder - you need to add RewriteBase /subfolder/ into .htaccess file after RewriteEngine on



Facebook API


To get number of likes, shares you must create facebook developer account and facebook web app. Read here how to do it: https://developers.facebook.com/docs/apps/register Once you create www app, get app id and app secret from Facebook Developer Dashboard and put them into ~root/config/facebook.php

Customization


Basic Settings

Open root/config/app.php file.
Set $config['admin_email'] to your e-mail address.
To limit the number of requests for each user, set $config['requests_per_day'] any number you want. If you do not want to limit user requests - set to 0
But be careful to allow user to do as many requests as they want, in this way your app may be banned because of spam.

SEO Settings

All SEO phrases located in root/config/seo.php

EUROPA websites must follow the Commission's guidelines on privacy and data protection and inform users that cookies are not being used to gather information unnecessarily.

All websites owned in the EU or targeted towards EU citizens, are now expected to comply with the law. If it is relevant for you and you are using 3rd party tools to analyze statistic, ads campaigns which are using cookies, then you need to inform user about it.

A simple floating widget is used which is enabled by default. All configuration settings are stored in ~root/config/cookieconsent.php file.

$config['cookieconsent_enable'] = true; // whether to show widget
$config['cookieconsent_learnmore'] = "Learn more"; // Learn more link text
$config['cookieconsent_dismiss'] = "Got it!"; // User confirmation text
$config['cookieconsent_message'] = "This website uses cookies to ensure you get the best experience on our website."; // Explanation
$config['cookieconsent_theme'] = "light-floating"; // theme: dark-top, dark-floating, dark-bottom, light-floating, light-top, light-bottom
$config['cookieconsent_link'] = "http://www.google.com/intl/en/policies/privacy/partners/"; // Leave empty to hide link (Learn more)



Cron Jobs

All user requests and urls are cached in the database .To remove expired URLs and user requests  you need to add following files into cron schedule:

If you do not have possibility to run cron jobs on your server then you need to modifiy api.php file. Add following lines in api.php file after try {
Model::clearRequest();
Model::removeExpiredUrls();

This modification has disadvantage: each user request will cause two extra database query, but we need to clear cache and expired urls.



API Documentation


 

You can receive the data by requesting URL:
http://domain.name/api.php
 
Parameters:
 
url: The URL of the page, including http, and www., if applicable. At this time, we do not provide canonicalization services. URL Encode to minimize errors.
response: The type of response that you would like to receive. For example: XML, JSON, Array(serialized). If you do not specify this parameter, you will receive a response as JSON.
 
API Example
 
Response as JSON
 
<?php
$url = "http://google.com";
$response = file_get_contents("http://domain.name/api.php?url=".urlencode($url));
$json = json_decode($response, true);
echo $url. " has ".$json["twitter"]." tweets, ".$json["facebook"]["like_count"]." likes, and ".$json["gplus"]. " +1\'s";
?>
 
Response as XML
 
<?php
$url = "http://google.com";
$response = file_get_contents("http://domain.name/api.php?url=".urlencode($url)."&response=xml");
$xml = simplexml_load_string($response);
echo $url. " has ".$xml->twitter." tweets, ".$xml->facebook->like_count." likes, and ".$xml->gplus." +1\'s";
?>

Before Buy


You can not run this script on a free web hosting, because their IPs banned on Google, Twitter, Facebook because of a spam.
Also, I am not responsible if your server's IP will be banned and script will not be able to get information from public API's.