Download the PHP package setono/sylius-analytics-plugin without Composer

On this page you can find all versions of the php package setono/sylius-analytics-plugin. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package sylius-analytics-plugin

Sylius Analytics Plugin

Latest Version Build Status

This plugin adds Google Analytics tracking to your store. You can choose between a gtag and tag manager integration. The gtag integration will output the traditional gtag() functions when tracking events, while the tag manager integration will populate the dataLayer with event data.

Installation

Step 1: Download the plugin

This plugin uses the TagBagBundle to inject scripts onto your page. Please read and follow the installation instructions for that bundle before installing this plugin.

NOTICE that the v4 of this plugin is still in alpha and hence breaking changes can occur.

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:

Step 3: Configure plugin

Step 4: Import routing

Step 5: Update your database schema

Step 6: Create a property / container

Click the Google Analytics link in your backend and create a new property/container.

Step 7: You're ready!

Your Sylius store will start tracking now!

The events that are available are:

and can be found in the EventSubscriber folder.

Read on if you want to enrich events with more data.

Enrich events with more data

When we want to track an event inside the Sylius application the Setono\GoogleAnalyticsBundle\Event\ClientSideEvent is fired.

That event holds the actual Google Analytics event, e.g. Setono\GoogleAnalyticsMeasurementProtocol\Request\Body\Event\PurchaseEvent. This way, if you subscribe to the ClientSideEvent, you can manipulate everything about the event before it's rendered (and sent to Google).

But there are other ways to change the data enrichment. This can be done via resolvers. The plugin uses resolvers to resolve a brand from a product, a category from a product etc. Read on to figure out how to use this functionality.

Brand resolver

An item has a brand property (item_brand), but the plugin doesn't know how you have chosen to add brand data in your application. Therefore, you need to implement your own BrandResolver. Here is an example:

When you implement the BrandResolverInterface and register your class as a service it will automatically be tagged with setono_sylius_analytics.brand_resolver and used when tracking.

Category resolver

An item has category properties (item_category, item_category2, etc.) and by default the plugin will resolve these properties based on either a product's main taxon or (if no main taxon is set) the first taxon in the collection of taxons.

You can see the implementation inside the Setono\SyliusAnalyticsPlugin\Resolver\Category\CategoryResolver class.

Item resolver

The job of the item resolver is to return an Setono\GoogleAnalyticsMeasurementProtocol\Request\Body\Event\Item\Item either from an order item or a product. This resolver also has a default implementation which you can see in the class Setono\SyliusAnalyticsPlugin\Resolver\Item\ItemResolver.

Items resolver

The items resolver must return an array of items given an order as input. The default implementation is found in the class Setono\SyliusAnalyticsPlugin\Resolver\Items\ItemsResolver.

Variant resolver

An item has a variant property (item_variant). How you want to view your variant data inside the Analytics user interface is up to you, however, the plugin provides two default resolvers, namely the Setono\SyliusAnalyticsPlugin\Resolver\Variant\NameBasedVariantResolver and the Setono\SyliusAnalyticsPlugin\Resolver\Variant\OptionBasedVariantResolver.

The option based version has the highest priority of the two and will therefore be tried first. It tries to create a variant string based on the options on the variant (if any).

The name based version returns the \Sylius\Component\Product\Model\ProductVariantInterface::getName().

To implement your own resolver just implement the Setono\SyliusAnalyticsPlugin\Resolver\Variant\VariantResolverInterface. Here is an example:

When you implement the VariantResolverInterface and register your class as a service it will automatically be tagged with setono_sylius_analytics.variant_resolver and used when tracking. Notice that the two existing variant resolver will remain as fallbacks.

Contribute

Ways you can contribute:

Thank you!


All versions of sylius-analytics-plugin with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
ext-json Version *
doctrine/collections Version ^1.8
doctrine/doctrine-bundle Version ^2.7
doctrine/orm Version ^2.14
knplabs/knp-menu Version ^3.3
psr/event-dispatcher Version ^1.0
psr/log Version ^1.1 || ^2.0 || ^3.0
setono/composite-compiler-pass Version ^1.1
setono/google-analytics-bundle Version ^2.0@alpha
setono/google-analytics-events Version ^1.0@rc
setono/google-analytics-measurement-protocol Version ^2.0@beta
sylius/channel Version ^1.0
sylius/channel-bundle Version ^1.0
sylius/core Version ^1.8
sylius/grid-bundle Version ^1.10
sylius/locale Version ^1.0
sylius/order Version ^1.0
sylius/product Version ^1.0
sylius/resource-bundle Version ^1.8
sylius/taxonomy Version ^1.0
sylius/ui-bundle Version ^1.0
symfony/config Version ^5.4 || ^6.0
symfony/dependency-injection Version ^5.4 || ^6.0
symfony/event-dispatcher Version ^5.4 || ^6.0
symfony/form Version ^5.4 || ^6.0
symfony/http-foundation Version ^5.4 || ^6.0
symfony/http-kernel Version ^5.4 || ^6.0
symfony/messenger Version ^5.4 || ^6.0
webmozart/assert Version ^1.11
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package setono/sylius-analytics-plugin contains the following files

Loading the files please wait ....