Download the PHP package dekar91/yii2-datalayer without Composer

On this page you can find all versions of the php package dekar91/yii2-datalayer. 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 yii2-datalayer

Latest Stable Version License Total Downloads Build Status

Yii2 DataLayer helper

This extension is managed to help you fulfill dataLayer variable with initial data on fly. Some Google enhanced e-commerce features are also available.

Installation

Then, register the component in your application config:

Configuration

Plugin involves both PHP and JavaScript functionality. PHP component supports following parameters:

Parameter Default Description
autoPublish true Whether catch EVENT_END_PAGE event in order to render DataLayer. If false you should render datalayer by yourself though getJs or render method
observers ['ec' => ['class' => DataLayerEc::class]] Array of classes may be used like wrapper on datalayer accessible by key each element must be following format: 'key' => ['class' => {name of class to be loaded}, 'options' => {Additional options}.
customEvents [] Array of event must be handled by JavaScript.Format: ['jsSelector' => 'nameOfEvent', 'customEventData']

Configuration example:

with this configuration you DataLayer will be published, DataLayerEc can be used by Yii::app()-> dalaLayer->ec, click on .btn-checkout will be handled and event information will be pushed in dataLayer.

Usage

Basic usage

You can push in dataLayer before rendering though Yii::app()-> dalaLayer->push();

Methods

Method Description
render($return = false) Render or return dataLayer Js variable
push(array $data, string $key = null) push data to dataLayer with corresponding key.
&getItem($key) return element of dataLayer by link

Enhanced e-commerce

Some basic functions of Enhanced e-commerce are supported by default class DataLayerEc. Please look though google documentation for further details.

Be careful! Do not push data in ajax request, it will not take effect.

Methods:

Method
currencyCode(string $currencyCode)
addProductImpression(array $product)
addPromoClick(array $product, array $action = [])
addPromoImpression(array $product)
addProductClick(array $product, array $action = [])
addProductDetails(array $product, array $action = [])
addToCart(array $product)
removeFromCart(array $product)
checkout(array $product, array $action = [])
checkoutOption($step, $checkoutOption)
purchase(array $purchase, array $products)
refund(array $transactionId, array $products = [])

User-defined observers

It's possible to extend dataLayer functionality by custom classes. While class is registered though observers property it can be used by Yii::app()->dataLayer->customClass. DataLayer object will be passed as first parameter in constructor.


All versions of yii2-datalayer with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
yiisoft/yii2 Version >=2.0
ezyang/htmlpurifier Version *
bower-asset/inputmask Version ~3.3.5
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 dekar91/yii2-datalayer contains the following files

Loading the files please wait ....