Giter Club home page Giter Club logo

googleapiclientbundle's Introduction

GoogleAPIClientBundle

The GoogleBundle adds the ability to add various Google services to your application. Currently Implemented: Google Analytics, Google Tag Manager and Client API

STABLE VERSION

Installation

Add the following to your composer.json file:

    {
        "require": {
            "rz/google-api-client-bundle" : "1.0.*"
        }
    }
    

Install the libraries by running:

    composer install

If everything worked, the Google Bundle can now be found at vendor/rz/google-api-client-bundle.

Finally, be sure to enable the bundle in AppKernel.php by including the following:

    // app/AppKernel.php
    public function registerBundles()
    {
        $bundles = array(
            //...
            new Rz\GoogleAPIClientBundle\RzGoogleAPIClientBundle(),
        );
    }
    

Configuration

Google Analytics

    rz_google_api_client:
      settings:
        google_services:
          ################
          # Sample Analytics Code replace with you own tracking code
          ################
          analytics:
            enabled: true
            tracking_id: UA-XXXXXXXX-X
            tracker_name: __rz_gaTracker
          ################
          # Sample GTM Code replace with you own tracking code
          ################
          tag_manager:
            enabled: true
            gtm_id: GTM-XXXXXX
    
        ################
        # Google Client API
        ################
        client_api:
          ################
          # Google Client API Public API
          ################
          public:
            app_name: rz-cms-XXXXXX
            api_key: ~
            site_name: rz-cms
          ################
          # Google Client API Service Account
          ################
          service:
            app_name: ~
            client_id: ~
            client_email: ~
            certificate_fingerprint: ~
            certificate_key: %kernel.root_dir%/config/rmzamora/rz/google_api_key/YOUR_KEY_HERE.json
            certificate_p12: %kernel.root_dir%/config/rmzamora/rz/google_api_key/YOUR_KEY_HERE.p12
            certificate_password: XXXXXXXX
          ################
          # Google Client API Web Application
          ################
          web_app:
            client_id: ~
            client_secret: ~

View Twig Helper

google analytics tracking code:

{{ rz_google_analytics_tracking_code() }}

google analytics event ie:pageview:

{{ rz_google_analytics_page_view() }}  

google analytics custom event ie:pageview with paramters:

{{ rz_google_analytics_page_view_custom({'page': /MY_PAGE_URL}) }}

google analytics dashboard requires RzBlockBundle and RzAdminBundle:

{{ rz_google_service_analytics_embed_api() }} //embed code required to use Analytics EmbedAPI

# SHOW YOUR SITE ANALYTICS on YOUR SonataAdmin Dashbaord - sonata_admin.yml
dashboard:
    blocks:
        - { position: top, type: rz_google_api_client.block.admin_ga_site_traffic, settings: { mode: admin, title: Google Analytics } }
        
# Register Block under sonata_block.yml           
rz_google_api_client.block.admin_ga_site_traffic:
    contexts: [admin]

screenshot


Alt text

Back to: rzproject

googleapiclientbundle's People

Contributors

rmzamora avatar

Stargazers

 avatar

Watchers

 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.