setono / sylius-analytics-plugin
Google Analytics plugin for Sylius
Fund package maintenance!
Setono
Installs: 220 358
Dependents: 0
Suggesters: 0
Security: 0
Stars: 20
Watchers: 3
Forks: 13
Open Issues: 2
Type:sylius-plugin
Requires
- php: >=8.1
- ext-json: *
- doctrine/collections: ^1.8
- knplabs/knp-menu: ^3.3
- psr/event-dispatcher: ^1.0
- psr/log: ^2.0 || ^3.0
- setono/google-analytics-bundle: ^1.0@alpha
- setono/google-analytics-measurement-protocol: ^1.0@alpha
- sylius/resource-bundle: ^1.8
- symfony/config: ^5.4 || ^6.0
- symfony/dependency-injection: ^5.4 || ^6.0
- symfony/event-dispatcher: ^5.4 || ^6.0
- symfony/form: ^5.4 || ^6.0
- symfony/http-foundation: ^5.4 || ^6.0
- symfony/http-kernel: ^5.4 || ^6.0
- symfony/mailer: ^5.4 || ^6.0
- webmozart/assert: ^1.11
Requires (Dev)
- api-platform/core: ^2.7
- behat/behat: ^3.12
- matthiasnoback/symfony-config-test: ^4.3
- matthiasnoback/symfony-dependency-injection-test: ^4.3
- phpunit/phpunit: ^9.5
- psalm/plugin-phpunit: ^0.18
- psalm/plugin-symfony: ^5.0
- setono/code-quality-pack: ^2.4
- sylius/sylius: ~1.12.3
- symfony/debug-bundle: ^5.4 || ^6.0
- symfony/dotenv: ^5.4 || ^6.0
- symfony/intl: ^5.4 || ^6.0
- symfony/property-info: ^5.4 || ^6.0
- symfony/serializer: ^5.4 || ^6.0
- symfony/web-profiler-bundle: ^5.4 || ^6.0
- symfony/webpack-encore-bundle: ^1.16
- 4.x-dev
- v4.0.0-alpha.1
- v4.0.0-alpha
- 3.x-dev
- v3.0.1
- v3.0.0
- v3.0.0-alpha.5
- v3.0.0-alpha.3
- v3.0.0-alpha.2
- v3.0.0-alpha
- 2.0.x-dev
- v2.0.4
- v2.0.3
- v2.0.2
- v2.0.1
- v2.0.0
- v2.0.0-alpha.3
- v2.0.0-alpha.2
- v2.0.0-alpha
- v1.1.2
- v1.1.1
- v1.1.0
- dev-master / 1.0.x-dev
- v1.0.0
- v1.0.0-beta.2
- v1.0.0-beta
- dev-configurable-events
- dev-add-view-item-event
- dev-dependabot/composer/phpunit/phpunit-tw-10.0
This package is auto-updated.
Last update: 2023-03-28 10:55:41 UTC
README
This plugin adds Google Analytics tracking to your store. It injects the tags directly and hence does not depend on third party tools like Google Tag Manager.
Installation
Step 1: Download the plugin
This plugin uses the TagBagBundle to inject scripts onto your page. Please install that bundle before installing this plugin.
composer require setono/sylius-analytics-plugin
Step 2: Enable the plugin
Then, enable the plugin by adding it to the list of registered plugins/bundles
in config/bundles.php
file of your project before (!) SyliusGridBundle
:
<?php $bundles = [ Setono\SyliusAnalyticsPlugin\SetonoSyliusAnalyticsPlugin::class => ['all' => true], Sylius\Bundle\GridBundle\SyliusGridBundle::class => ['all' => true], ];
Step 3: Configure plugin
# config/packages/setono_sylius_analytics.yaml imports: # ... - { resource: "@SetonoSyliusAnalyticsPlugin/Resources/config/app/config.yaml" } # ...
Step 4: Import routing
# config/routes/setono_sylius_analytics.yaml setono_sylius_analytics: resource: "@SetonoSyliusAnalyticsPlugin/Resources/config/routes.yaml"
Step 5: Update your database schema
php bin/console doctrine:migrations:diff php bin/console doctrine:migrations:migrate
Step 6: Create a property
When you create a property in Google Analytics you receive a measurement id which looks something like G-12345678.
Now create a new property in your Sylius shop by navigating to /admin/google-analytics/properties/new
.
Remember to enable the property and enable the channels you want to track.
Step 7: You're ready!
The events that are tracked are located in the EventSubscriber folder.
Contribute
Ways you can contribute:
- Translate messages and validators into your mother tongue
- Create Behat tests that verifies the scripts are outputted on the respective pages
- Create new event subscribers that handle Analytics events which are not implemented
Thank you!