Skip to content

webgriffe/SyliusFacebookPlugin

 
 

Repository files navigation

Sylius Facebook Plugin

Latest Version Latest Unstable Version Software License Build Status Quality Score

Track user behavior in Facebook.

Installation

Step 1: Download the plugin

This plugin uses the TagBagBundle to inject scripts onto your page.

Open a command console, enter your project directory and execute the following command to download the latest stable version of this plugin:

$ composer require setono/sylius-facebook-plugin

# Omit this line if you want to override layout.html.twig as described at https://github.com/Setono/TagBagBundle#usage
$ composer require setono/sylius-tag-bag-plugin

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.

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\TagBagBundle\SetonoTagBagBundle::class => ['all' => true],
    
    // Omit this line if you didn't install the SyliusTagBagPlugin in step 1
    Setono\SyliusTagBagPlugin\SetonoSyliusTagBagPlugin::class => ['all' => true],
    
    Setono\SyliusFacebookPlugin\SetonoSyliusFacebookPlugin::class => ['all' => true],
    Sylius\Bundle\GridBundle\SyliusGridBundle::class => ['all' => true],
];

Step 3: Configure plugin

# config/packages/_sylius.yaml
imports:
    # ...
    - { resource: "@SetonoSyliusFacebookPlugin/Resources/config/app/config.yaml" }
    # ...

Step 4: Import routing

# config/routes/setono_sylius_facebook.yaml
setono_facebook_tracking:
    resource: "@SetonoSyliusFacebookPlugin/Resources/config/routing.yaml"

Step 5: Update your database schema

$ php bin/console doctrine:migrations:diff
$ php bin/console doctrine:migrations:migrate

Step 6: Create a pixel

When you create a pixel in Facebook you receive a pixel id.

Now create a new pixel in your Sylius shop by navigating to /admin/pixels/new. Remember to enable the pixel and enable the channels you want to track.

Step 7: You're ready!

The events that are tracked are located in the EventListener folder.

Contribute

Ways you can contribute:

  • Translate messages and validators to your mother tongue
  • Create Behat tests that verifies the scripts are outputted on the respective pages
  • Create new event subscribers that handle Facebook events which are not implemented

Thank you!

About

Track visitors in your Sylius store

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 86.7%
  • Twig 7.5%
  • JavaScript 4.0%
  • Gherkin 1.8%