Download the PHP package heimrichhannot/contao-social-stats-bundle without Composer
On this page you can find all versions of the php package heimrichhannot/contao-social-stats-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download heimrichhannot/contao-social-stats-bundle
More information about heimrichhannot/contao-social-stats-bundle
Files in heimrichhannot/contao-social-stats-bundle
Package contao-social-stats-bundle
Short Description This bundle collects data about news entries.
License LGPL-3.0-or-later
Informations about the package contao-social-stats-bundle
Contao Social Stats Bundle
This bundle collects data about news entries. Currently it contains a command to update some stats for news articles from some networks.
Features
- following stats are collected:
- Google Analytics: Unique page view
- Facebook: share count
- Matomo: hits
Setup
Requirements
- PHP 7.2 or higher (not tested with 8.0 and higher)
- Contao 4.4 or higher
Additional:
- Google Analytics: Google APIs Client Library for PHP
Install
-
Install with composer or contao manager
composer require heimrichhannot/contao-social-stats-bundle
-
Updated database
php vendor/bin/contao-console contao:migrate
-
Setup a cronjob for SocialStatsCommand (see Usage -> Command for more information)
- /1 php vendor/bin/contao-console huh:socialstats:update
Configuration
Most platforms neeed additions configurtation like access tokens. See configuration reference about what you need.
Usage
Command
Work with the values
The values collected by the command are written into the huh_socialstats_values
field of tl_news. You get them as array after a simple \Contao\StringUtil::deserialze($newsItemModel->huh_socialstats_values, true)
. The time of the last update of the stats is written into tl_news.huh_socialstats_last_updated
.
Google Analytics
We use the Google APIs Client Library for PHP to obtain the values. For this to work you need:
- a Google API Console project
- a key file
- a view id
Here you find all informations how to gain these components: https://developers.google.com/analytics/devguides/reporting/core/v4/quickstart/web-php
Add custom news routes
By default, the platforms are searched for the default news url (the page you set in the news archive plus an identifier, typical the news alias, see \Contao\News::generateNewsUrl()
). If you output your news on multiple locations or have some custom routing, you can add or change the urls with AddNewsArticleUrlsEvent
Configuration reference
All versions of contao-social-stats-bundle with dependencies
contao/core-bundle Version ^4.9
contao/news-bundle Version ^4.4
guzzlehttp/guzzle Version ^6.0 || ^7.0
symfony/console Version ^4.4 || ^5.4
symfony/config Version ^4.4 || ^5.4
symfony/dependency-injection Version ^4.4 || ^5.4
symfony/event-dispatcher Version ^4.4 || ^5.4
symfony/http-kernel Version ^4.4 || ^5.4