s-punkt-online / contao-google-reviews-widget
Google Reviews Widget for Contao CMS with frontend module and content element support.
Package info
github.com/S-Punkt-Online/Google-Bewertungen-Widget
Type:contao-bundle
pkg:composer/s-punkt-online/contao-google-reviews-widget
Requires
- php: ^8.1
- contao/core-bundle: ^5.3
- contao/manager-plugin: ^2.13
- psr/log: ^3.0
- symfony/http-client-contracts: ^3.0
Requires (Dev)
- contao/easy-coding-standard: ^7.1
- phpunit/phpunit: ^10.5
- symfony/http-client: ^6.4
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Google Reviews Widget for Contao CMS with support for:
- Frontend Module
- Content Element
- Google Places API
- Schema.org structured data
- Local JSON caching
Features
- Display Google ratings
- Average star rating
- Total review count
- Link to Google reviews
- Local caching
- Automatic hide if no reviews available
- Usable as:
- Frontend Module
- Content Element
Installation
Via Contao Manager
Search for:
s-punkt-online/contao-google-reviews-widget
Install the package and run the database migration.
Via Composer
composer require s-punkt-online/contao-google-reviews-widget
Then clear the cache:
vendor/bin/contao-console cache:clear
Google API Setup
1. Create Google Cloud Project
Open Google Cloud Console:
https://console.cloud.google.com
2. Enable Places API
Enable:
Places API
Important:
Do not only enable Places API (New).
This extension currently uses the classic Places API.
3. Create API Key
Open:
APIs & Services → Credentials
Create a new API key.
4. Configure API Key
Application restrictions
For testing:
None
Later recommended:
- IP restriction for your server
Important:
Do not use HTTP Referrer restrictions because the API requests are executed server-side via PHP.
API restrictions
Allow:
Places API
Find Google Place ID
Use:
https://developers.google.com/maps/documentation/javascript/examples/places-placeid-finder
Usage as Frontend Module
Backend:
Themes → Frontend Modules
Module type:
Google Reviews Widget
Usage as Content Element
Backend:
Articles → New Element
Element type:
Google Reviews Widget
Available Fields
Google API Key
Your Google API key.
Google Place ID
Google Place ID of the business.
Business Name
Used for Schema.org structured data.
Example:
Example Company GmbH
Business URL
Example:
https://www.example.com
Google Review URL
Direct link to Google reviews.
Position
Where the widget is shown on the page: bottom left (default) or bottom right.
Accent Color
Color used for the border, stars and button. Leave empty for the default color.
Cache
Google API responses are stored locally.
Path:
var/cache/contao-google-reviews-widget/
Benefits:
- Better performance
- Fewer API requests
- Lower Google API costs
The rating is refreshed once every 24 hours. If a request to Google fails (outage, exhausted quota, invalid key), the last known rating keeps being shown and Google is not asked again for 15 minutes. The error is written to the Contao system log (without the API key).
Template Override
Template:
ce_google_reviews_widget.html5
Can be overridden inside your Contao project.
CSS & JavaScript
Assets are loaded automatically.
Files:
public/css/google-reviews-widget.css
public/js/google-reviews-widget.js
Requirements
- Contao 5.3+
- PHP 8.1+
- Enabled Google Places API
Support
S Punkt Online GmbH