Giter VIP home page Giter VIP logo

utm-cookie-bundle's Introduction

MedelseUtmCookieBundle

The MedelseUtmCookieBundle is a Symfony Bundle to save utm parameters from url into cookie when exists. Than cookie (utm) can be used later without parsing google or any other cookies.

Features include:

  • Compatible Symfony version 3 & 4

Installation

Through Composer:

Install the bundle:

$ composer require medelse/utm-cookie-bundle

Register the bundle in app/AppKernel.php (Symfony V3):

// app/AppKernel.php

public function registerBundles()
{
    return array(
        // ...
        new Medelse\UtmCookieBundle\MedelseUtmCookieBundle(),
    );
}

Register the bundle in app/AppKernel.php (Symfony V4):

// config/bundles.php

return [
    // ...
    Medelse\UtmCookieBundle\MedelseUtmCookieBundle::class => ['all' => true],
];

Parameters :

medelse_utm_cookie:
    name: 'utm' #The Name of cookie (default value "utm")
    lifetime: 604800 #The lifetime of cookie in seconds (default 604800 => 7 days)
    path: '/' #The path on the server in which the cookie will be available on (default '/')
    domain: '' #The (sub)domain that the cookie is available to (default '' so use current domain)
    overwrite: true|false #If overwrite all utm values when even one is set in get (default true)
    secure: true|false #Indicates that the cookie should only be transmitted over a secure HTTPS connection from the client (default false)
    httponly: true|false #When TRUE the cookie will be made accessible only through the HTTP protocol (default false)
    auto_init: true|false #If true, run init and create cookie automatically. If false you have to call init manually (default true)

Usage

Public service

The service name available is medelse_utm_cookie.utm_cookie

Basic Usage

$this->get('medelse_utm_cookie.utm_cookie')->init(); // just init - read utm params and cookie and save new values. (optionnal if auto_init config is TRUE or automatically called when call get() method)
$this->get('medelse_utm_cookie.utm_cookie')->get(); // get all utm cookies as array
$this->get('medelse_utm_cookie.utm_cookie')->get('utm_source'); // get utm_source
$this->get('medelse_utm_cookie.utm_cookie')->get('source'); // get utm_source

License

This bundle is under the MIT license.

utm-cookie-bundle's People

Contributors

thomas-medelse avatar h3llr4iser avatar bilbous avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.