Code Monkey home page Code Monkey logo

google-api's Introduction

Google Api pro Nette Framework

Nastavení v config.neon

extensions:
    googleApi: NAtrreid\GoogleApi\DI\GoogleApiExtension

googleApi:
    gaClientId: 'UA-XXXXXXXX-X'
    webMasterKey: 'xxx1x1xxxx1xx1xx12XXXX123x1x1234xx1x12x123x'
    merchantKey: 'xxx1x1xxxx1xx1xx12XXXX123x1x1234xx1x12x123x'
    adWordsConversionId: '1234567890'
    adWordsConversionLabel: 'xxx1XXx1xXXX123X1xX'
    anonymizeIp: false

Použití

/** @var NAttreid\GoogleApi\IGoogleApiFactory @inject */
public $googleApiFactory;

protected function createComponentGoogleApi() {
    return $this->googleApiFactory->create();
}

public function someRender() {
    $this['googleApi']->pageView('/product','Product');   // pageView

    // adwords
    $this['googleApi']->remarketingEcomm('product', 3.5, 123);   // remarketing
    $this['googleApi']->conversion(3.5, 'CZK');                  // konverze
    
    // eCommerce
    $transaction = new Transaction;
    $transaction->id = 12345;
    $transaction->value = 5.5;
    $transaction->shipping = 1;

    $item = new Item;
    $item->id = 1;
    $item->name = 'Item';
    $item->sku = 'code';
    $item->category = 'category';
    $item->price = 5.5;
    $item->quantity = 1;
    $transaction->addItem($item);
    
    $this['googleApi']->transaction($transaction);
}

v @layout.latte

<html>
<head>
    <!-- html kod -->
    {control googleApi}
</head>
<body>
    {control googleApi:event}
    <!-- html kod -->
</body>
</html>

google-api's People

Contributors

attreid avatar

Watchers

James Cloos avatar  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.