2017 © Pedro PelĆ”ez
 

symfony-bundle sylius-google-ecommerce-bundle

Sylius integration with Google's Enhanced E-Commerce tracking within Google Analytics

image

webburza/sylius-google-ecommerce-bundle

Sylius integration with Google's Enhanced E-Commerce tracking within Google Analytics

  • Thursday, December 29, 2016
  • by dkarlovi
  • Repository
  • 1 Watchers
  • 20 Stars
  • 650 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 8 Forks
  • 1 Open issues
  • 10 Versions
  • 4 % Grown

The README.md

Sylius & Google Enhanced E-Commerce integration bundle

Build Status, (*1)

This bundle integrates Google's Enhanced E-Commerce (GEEC) tracking into Sylius., (*2)

Documentation

Basic installation

  1. require the bundle with Composer:, (*3)

    $ composer require webburza/sylius-google-ecommerce-bundle
  2. enable the bundle:, (*4)

    <?php
    // app/AppKernel.php
    
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new \Webburza\Sylius\GoogleEcommerceBundle\WebburzaSyliusGoogleEcommerceBundle(),
            // ...
        );
    }
  3. add application-specific bundle configuration, (*5)

    # app/config/config.yml
    
    webburza_sylius_google_ecommerce:
        key: %webburza.sylius.google_ecommerce.key%
  4. add application-specific bundle parameters (mainly, your Google Analytics key), (*6)

    # app/config/parameters.yml
    
    webburza.sylius.google_ecommerce.key: UA-12345678-1
  5. enable GEEC block rendering in your Twig layout, (*7)

     <!-- App/ShopBundle/Resources/views/layout.html.twig -->
    
         <!-- add -->
         {{ google_ecommerce_render() }}
         <!-- /add -->
         </body>
     </html>

Having done this properly, you should have a functional Google Analytics tracking (without the e-commerce part). You can verify it works by using Google Analytics Debugger., (*8)

Enabling the e-commerce integration

To enable the e-commerce part of the bundle, we need to tell it what the user is doing. We do this by using prepared Twig functions., (*9)

Direct action functions

These are direct responses to user doing an action., (*10)

  • {{ google_ecommerce_impression(variant, {"list": list, "position": loop.index}) }}
    mark a product impression in a listing.
    Params:
    • variant, an instance of a Sylius ProductVariant
    • list, a (string) name of the list in which the product is being displayed, ie. "search results"
    • position, the position of the product in that list, starting from 1
  • {{ google_ecommerce_details(variant) }}
    used only to indicate we're viewing a single product details view.
    Params:
    • variant, an instance of a Sylius ProductVariant
  • {{ google_ecommerce_checkout(order, {'step': 2}) }}
    indicate the progression of a checkout.
    Params:
    • order, an instance of a Sylius Order
    • step, which step are we currently on? Make sure to configure the checkout funnel, as described in the documentation.
  • {{ google_ecommerce_purchase(order) }}
    indicate a successful transaction.
    Params:
    • order, an instance of a Sylius Order

Action handler functions

These functions will render a handler which will react to user actions and invoke a direct action., (*11)

  • {{ google_ecommerce_click(variant, {"list": list}) }}
    track the click on the product in a listing.
    Params:
    • variant, an instance of a Sylius ProductVariant
    • list, a (string) name of the list in which the product is being displayed, ie. "search results"
  • {{ google_ecommerce_cart(variant, {'action': 'add', 'callable': 'function(product) {product[\'variant\'] = \'TODO: which variant?\'; return product;}'}) }}
    adding a product variant to cart.
    Params:
    • variant, an instance of a Sylius ProductVariant
    • event, the Javascript event to react to, defaults to "submit"
    • action, always "add"
    • callable, an optional Javascript callback which adds additional product information (like variant)
  • {{ google_ecommerce_cart(variant, {'event': 'click', 'action': 'remove', 'variant': item.vars.value.variant.__toString()}) }}
    removing a product from cart.
    Params:
    • variant, an instance of a Sylius ProductVariant
    • event, as we're using a hyperlink, this must be "click"
    • action, always "remove"
    • variant, as we know what's the product variant at render time, we do not need the JS callback as for the adding.
  • {{ google_ecommerce_render() }}
    render the current GEEC block. This was the function used in Basic installation.
    Params: none.

License

This bundle is available under the MIT license., (*12)

Contributing

TODO, (*13)

The Versions

29/12 2016

dev-develop

dev-develop

Sylius integration with Google's Enhanced E-Commerce tracking within Google Analytics

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dalibor Karlović

analytics symfony google e-commerce ecommerce sylius enhanced web.burza

29/12 2016

0.3.1

0.3.1.0

Sylius integration with Google's Enhanced E-Commerce tracking within Google Analytics

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dalibor Karlović

analytics symfony google e-commerce ecommerce sylius enhanced web.burza

29/12 2016

dev-master

9999999-dev

Sylius integration with Google's Enhanced E-Commerce tracking within Google Analytics

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dalibor Karlović

analytics symfony google e-commerce ecommerce sylius enhanced web.burza

29/12 2016

0.3.0

0.3.0.0

Sylius integration with Google's Enhanced E-Commerce tracking within Google Analytics

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dalibor Karlović

analytics symfony google e-commerce ecommerce sylius enhanced web.burza

30/08 2016

v0.2.0

0.2.0.0

Sylius integration with Google's Enhanced E-Commerce tracking within Google Analytics

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dalibor Karlović

analytics symfony google e-commerce ecommerce sylius enhanced web.burza

09/06 2016

v0.1.0

0.1.0.0

Sylius integration with Google's Enhanced E-Commerce tracking within Google Analytics

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dalibor Karlović

analytics symfony google e-commerce ecommerce sylius enhanced web.burza

10/03 2016

0.0.4

0.0.4.0

Sylius integration with Google's Enhanced E-Commerce tracking within Google Analytics

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dalibor Karlović

analytics symfony google e-commerce ecommerce sylius enhanced web.burza

07/03 2016

0.0.3

0.0.3.0

Sylius integration with Google's Enhanced E-Commerce tracking within Google Analytics

  Sources   Download

MIT

The Requires

 

by Dalibor Karlović

analytics symfony google e-commerce ecommerce sylius enhanced web.burza

07/03 2016

0.0.2

0.0.2.0

Sylius integration with Google's Enhanced E-Commerce tracking within Google Analytics

  Sources   Download

MIT

The Requires

 

by Dalibor Karlović

26/02 2016

0.0.1

0.0.1.0

Sylius integration with Google's Enhanced E-Commerce tracking within Google Analytics

  Sources   Download

The Requires

 

by Dalibor Karlović