PHP code example of meinfernbus / google-bundle
1. Go to this page and download the library: Download meinfernbus/google-bundle library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
meinfernbus / google-bundle example snippets
public function registerBundles()
{
return array(
new AntiMattr\GoogleBundle\GoogleBundle(),
);
}
$this->container()->get('google.analytics')->setCustomPageView('/profile/'.$username);
$this->container()->get('google.analytics')->enqueuePageView('/my-first-page-view-in-queue');
$this->container()->get('google.analytics')->enqueuePageView('/my-second-page-view-in-queue');
$transaction = new \AntiMattr\GoogleBundle\Analytics\Transaction();
$transaction->setOrderNumber('xxxx');
$transaction->setAffiliation('Store 777');
$transaction->setTotal(100.00);
$transaction->setTax(10.00);
$transaction->setShipping(5.00);
$transaction->setCity("NYC");
$transaction->setState("NY");
$transaction->setCountry("USA");
$this->get('google.analytics')->setTransaction($transaction);
$item = new \AntiMattr\GoogleBundle\Analytics\Item();
$item->setOrderNumber('xxxx');
$item->setSku('zzzz');
$item->setName('Product X');
$item->setCategory('Category A');
$item->setPrice(50.00);
$item->setQuantity(1);
$this->get('google.analytics')->addItem($item);
$item = new \AntiMattr\GoogleBundle\Analytics\Item();
$item->setOrderNumber('bbbb');
$item->setSku('jjjj');
$item->setName('Product Y');
$item->setCategory('Category B');
$item->setPrice(25.00);
$item->setQuantity(2);
$this->get('google.analytics')->addItem($item);
$this->get('google.adwords')->activateConversionByKey('account_create');
use AntiMattr\GoogleBundle\Maps\StaticMap;
use AntiMattr\GoogleBundle\Maps\Marker;
...
/** @var \AntiMattr\GoogleBundle\MapsManager $googleContainer */
$googleContainer = $this->container->get('google.maps');
$map = $googleContainer->createStaticMap();
$map->setId("Paul");
$map->setSize("512x512");
$marker = new Marker();
$marker->setLatitude(40.596631);
$marker->setLongitude(-73.972359);
$map->addMarker($marker);
$googleContainer->addMap($map);