PHP code example of promatur / sc-analytics
1. Go to this page and download the library: Download promatur/sc-analytics library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
promatur / sc-analytics example snippets
// - Configure your preferred analytics endpoint
\ScAnalytics\Core\AnalyticsConfig::$matomoID = "1";
\ScAnalytics\Core\AnalyticsConfig::$matomoEndpoint = "https://analytics.example.com/";
// - Initialize the analytics system
\ScAnalytics\Analytics::init();
// - Get your Analytics Handler
$analytics = Analytics::get();
// - Load the Client-Side JavaScript code and initialize the page view
$pageData = new \ScAnalytics\Core\PageData("Help Page", ["Support", "Help Page Overview"])
// Put this anywhere you want to load the JavaScript code
echo $analytics->loadJS($pageData);
\ScAnalytics\Core\AnalyticsConfig::$assets = "my-directory";