Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Adback Analytics Laravel Package

dekalee/adback-analytics

Laravel package for tracking and analyzing admin/back-office activity. Capture actions and events, store analytics, and review insights to monitor usage and improve workflows. Designed to integrate into existing Laravel admin panels with minimal setup.

View on GitHub
Deep Wiki
Context7

Adback/Analytics

Scrutinizer Code Quality Code Coverage Build Status Latest Stable Version Total Downloads License

This PHP library will call the AdBack API and will generate the JavaScript tag that should be placed on all the pages.

See the AdBack website for more informations.

See the AdBack documentation for an installation guide.

Usage

Both the Query and Generators will need a driver which implements the ScriptCacheInterface to work.

A driver for Redis is already available.

Usage Exemple

Installation

Use composer to install the lib :

    composer require dekalee/adback-analytics

Usage with Redis

Query the api

First you need to query the api to warmup the cache in a Redis data store :

    use Dekalee\AdbackAnalytics\Client\Client;
    use Dekalee\AdbackAnalytics\Driver\RedisScriptCache;
    use Dekalee\AdbackAnalytics\Query\ScriptUrlQuery;

    function createApiCache()
    {
        $client = new Client();
        $redis = new \Redis();
        $redis->connect('127.0.0.1');
        $redisCache = new RedisScriptCache($redis);

        $query = new ScriptUrlQuery($client, $redisCache, 'your-token');
        $query->execute();
    }

    createApiCache();

Generate the scripts

In your page, preferably in the <head>, use the generator to create the script :

    use Dekalee\AdbackAnalytics\Driver\RedisScriptCache;
    use Dekalee\AdbackAnalytics\Generator\AnalyticsScriptGenerator;

    function generateAnalyticsScript()
    {
        $redis = new \Redis();
        $redis->connect('127.0.0.1');
        $redisCache = new RedisScriptCache($redis);
        $generator = new AnalyticsScriptGenerator($redisCache);

        return $generator->generate();
    }

    echo generateAnalyticsScript();

You could do the same to create the other scripts by using the appropriate generators.

Usage with MySQL

Create the table

To create the table used to store the data in MySQL, run the query:

    CREATE TABLE adback_cache_table( our_key varchar(255), our_value varchar(255));

With the PDO driver

Query the api

First you need to query the api to warmup the cache in a Mysql table :

    use Dekalee\AdbackAnalytics\Client\Client;
    use Dekalee\AdbackAnalytics\Driver\PdoScriptCache;
    use Dekalee\AdbackAnalytics\Query\ScriptUrlQuery;

    function createApiCache()
    {
        $client = new Client();
        $connection = new \PDO('mysql:host=your-database-host;dbname=your-database;charset=utf8', 'login', 'password');
        $cache = new PdoScriptCache($connection);

        $query = new ScriptUrlQuery($client, $cache, 'your-token');
        $query->execute();
    }

    createApiCache();
Generate the scripts

In your page, preferably in the <head>, use the generator to create the script :

    use Dekalee\AdbackAnalytics\Generator\AnalyticsScriptGenerator;
    use Dekalee\AdbackAnalytics\Driver\PdoScriptCache;


    function generateAnalyticsScript()
    {
        $connection = new \PDO('mysql:host=your-database-host;dbname=your-database;charset=utf8', 'login', 'password');
        $cache = new PdoScriptCache($connection);
        $generator = new AnalyticsScriptGenerator($cache);

        return $generator->generate();
    }

    echo generateAnalyticsScript();

You could do the same to create the other scripts by using the appropriate generators.

With the Mysqli driver

Query the api

First you need to query the api to warmup the cache in a Mysql table :

    use Dekalee\AdbackAnalytics\Client\Client;
    use Dekalee\AdbackAnalytics\Driver\MysqliScriptCache;
    use Dekalee\AdbackAnalytics\Query\ScriptUrlQuery;

    function createApiCache()
    {
        $client = new Client();
        $connection = new \mysqli('your-database-host', 'login', 'password', 'your-database');
        $cache = new MysqliScriptCache($connection);

        $query = new ScriptUrlQuery($client, $cache, 'your-token');
        $query->execute();
    }

    createApiCache();
Generate the scripts

In your page, preferably in the <head>, use the generator to create the script :

    use Dekalee\AdbackAnalytics\Generator\AnalyticsScriptGenerator;
    use Dekalee\AdbackAnalytics\Driver\PdoScriptCache;


    function generateAnalyticsScript()
    {
        $connection = new \mysqli('your-database-host', 'login', 'password', 'your-database');
        $cache = new MysqliScriptCache($connection);
        $generator = new AnalyticsScriptGenerator($cache);

        return $generator->generate();
    }

    echo generateAnalyticsScript();

You could do the same to create the other scripts by using the appropriate generators.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky