Giter Club home page Giter Club logo

icecast2matomo's Introduction

Icecast2Matomo

This is a script I wrote to send listener information from an Icecast server into a Matomo (Piwik) instance.


How It Works

Matomo offers a Tracking HTTP API for sites and services where tracking may be very limited. This script bridges the gap between Icecast and Matomo by making use of Icecast's XML output, then sending an HTTP request to Matomo for each listener—complete with their IP address and user agent.


Requirements

  • PHP 7 or newer (tested to work in PHP 7.4)
  • php_curl extension
  • Crontab (for automatically running the script)
  • An Icecast server with admin access
  • A Matomo server with write/admin access

Getting Started

  1. Download the script to your Icecast server.
  2. Customize the script to add your Icecast and Matomo server URLs, as well as change any links and provide your auth token.
  3. Run the script using php /path/to/script.php and check Matomo for results. The console will log all connections to Matomo by IP along with the HTTP code (should always be "200"). A successful run will show something close to this:
[mm-dd-yyyy, hh-mm-ss]
Sent request to Matomo for x.x.x.x (200)
Sent request to Matomo for x.x.x.x (200)
... continues for each IP ...
Complete!

If no listeners are connected:

[mm-dd-yyyy, hh-mm-ss]
No listeners connected.
Complete!
  1. If successful, configure Crontab to automatically run the script. I run it every minute on my server but feel free to make it as often as you'd like. Be sure to configure Matomo's archival process! See crontab for a complete list.

Shoutout

Big thanks to iroks for their Icecast2GoogleAnalytics program. This was my main solution for a long time until Google Analytics phased out Universal Analytics and began pushing GA4. The library used for GA hasn't been updated for GA4. I've borrowed its naming convention because these are both adapters from Icecast to an analytics service.

icecast2matomo's People

Contributors

simsnet avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.