PHPackages                             meinfernbus/google-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. meinfernbus/google-bundle

ActiveSymfony-bundle[Templating &amp; Views](/categories/templating)

meinfernbus/google-bundle
=========================

Fork of AntiMattr GoogleBundle. Static Google maps with caching, Adwords with remarketing &amp; lots of other fixes.

v0.2.2(5y ago)1176.8k↓33.3%8[1 PRs](https://github.com/meinfernbus/GoogleBundle/pulls)MITPHPPHP ^7.2

Since Jan 31Pushed 3y ago5 watchersCompare

[ Source](https://github.com/meinfernbus/GoogleBundle)[ Packagist](https://packagist.org/packages/meinfernbus/google-bundle)[ RSS](/packages/meinfernbus-google-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (9)Versions (7)Used By (0)

[![Build Status](https://camo.githubusercontent.com/067c6425010275dffe7bc87f963e30f17c6b254892792b1fdd95780e6caffd3b/68747470733a2f2f7472617669732d63692e6f72672f6d65696e6665726e6275732f476f6f676c6542756e646c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/meinfernbus/GoogleBundle)

GoogleBundle
============

[](#googlebundle)

The GoogleBundle adds the ability to add various google-related services to your application. These include Google Analytics, Adwords and Static Maps. This module was forked a long time ago from  but is now maintained as a separate project.

Installation
------------

[](#installation)

### Composer

[](#composer)

composer require meinfernbus/google-bundle

### Application Kernel

[](#application-kernel)

Add GoogleBundle to the `registerBundles()` method of your application kernel:

```
    public function registerBundles()
    {
        return array(
            new AntiMattr\GoogleBundle\GoogleBundle(),
        );
    }
```

Configuration
-------------

[](#configuration)

### Google Analytics

[](#google-analytics)

#### Application config.yml

[](#application-configyml)

Enable loading of the Google Analytics service by adding the following to the application's `config.yml` file:

```
    google:
        analytics:
            trackers:
                default:
                    name:      MyJavaScriptCompatibleVariableNameWithNoSpaces
                    accountId: UA-xxxx-x
                    domain:    .mydomain.com
                    trackPageLoadTime: true
                    anonymizeIp: false
```

#### View

[](#view)

Include the Google Analytics Async template in the `head` tag or just before the `` of your layout (The template will lazy load \_gaq).

With twig:

```
    {% include "GoogleBundle:Analytics:async.html.twig" %}
```

#### Features

[](#features)

##### Logging a Default Page View

[](#logging-a-default-page-view)

```
Requires no additional code

```

##### Sending a Custom Page View

[](#sending-a-custom-page-view)

```
    $this->container()->get('google.analytics')->setCustomPageView('/profile/'.$username);
```

##### Adding to Page View Queue

[](#adding-to-page-view-queue)

Note: Page View Queue is always executed before a Custom Page View

```
    $this->container()->get('google.analytics')->enqueuePageView('/my-first-page-view-in-queue');
    $this->container()->get('google.analytics')->enqueuePageView('/my-second-page-view-in-queue');
```

##### Ecommerce Tracking

[](#ecommerce-tracking)

```
    $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);
```

### Google Adwords

[](#google-adwords)

#### Application config.yml

[](#application-configyml-1)

Enable loading of the Google Adwords service by adding the following to the applications's `config.yml` file:

```
    google:
        adwords:
            conversions:
                account_create:
                    id:    111111
                    label: accountCreateLabel
                    value: 0
                    remarketing: false
                checkout_thanks:
                    id:    222222
                    label: checkoutThanksLabel
                    value: 0
                    remarketing: false
                remarketing:
                    id:    333333
                    label: "google-assigned-remarketing-label"
                    value: 0
                    remarketing: true
```

#### Controller

[](#controller)

```
    $this->get('google.adwords')->activateConversionByKey('account_create');
```

#### View

[](#view-1)

Include the Google Adwords tracking template like this

```
    {% include "GoogleBundle:Adwords:track.html.twig" %}
```

### Google Maps - Static Map

[](#google-maps---static-map)

#### Application config.yml

[](#application-configyml-2)

Enable loading of the Google Maps Static service by adding the following to the applications's `config.yml` file:

```
google:
    maps:
        config:
            key: YOUR-API-KEY-FROM-GOOGLE
            host: YOUR-HOST // Host where the gmap image is served.
            (Optional, only needed if script is running from CLI. If not set $_SERVER is used)
            uploadDir: '%kernel.project_dir%/web/maps' // absolute path to directory where map files
            publicDir: '/maps' //http path where map files supposed to be publicly available

```

Get your key at

#### Controller

[](#controller-1)

```
    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);
```

#### View

[](#view-2)

Include the Google Maps in your template like this:

```
    {% if google_maps.hasMaps() %}
		{% for map in google_maps.getMaps() %}
			{% autoescape false %}
				{{ map.render }}
			{% endautoescape %}
		{% endfor %}
	{% endif %}
```

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity37

Limited adoption so far

Community23

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~284 days

Recently: every ~353 days

Total

6

Last Release

1971d ago

Major Versions

v0.1.0 → 2.3.x-dev2017-02-10

PHP version history (2 changes)v0.1.0PHP &gt;=5.6

v0.2.0PHP ^7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/c3126d7a7e9d28c201e6a47a79e454cc180d420b5107083428bf1c86cfa9ee39?d=identicon)[meinfernbus](/maintainers/meinfernbus)

---

Top Contributors

[![matthewfitz](https://avatars.githubusercontent.com/u/208401?v=4)](https://github.com/matthewfitz "matthewfitz (54 commits)")[![EricReiche](https://avatars.githubusercontent.com/u/894987?v=4)](https://github.com/EricReiche "EricReiche (36 commits)")[![ilantushenko](https://avatars.githubusercontent.com/u/5979230?v=4)](https://github.com/ilantushenko "ilantushenko (7 commits)")[![pulse00](https://avatars.githubusercontent.com/u/185278?v=4)](https://github.com/pulse00 "pulse00 (7 commits)")[![mente](https://avatars.githubusercontent.com/u/391997?v=4)](https://github.com/mente "mente (6 commits)")[![j4nD](https://avatars.githubusercontent.com/u/13164737?v=4)](https://github.com/j4nD "j4nD (4 commits)")[![munzarf](https://avatars.githubusercontent.com/u/17239114?v=4)](https://github.com/munzarf "munzarf (2 commits)")[![meinfernbus](https://avatars.githubusercontent.com/u/1415545?v=4)](https://github.com/meinfernbus "meinfernbus (2 commits)")[![kriswallsmith](https://avatars.githubusercontent.com/u/33886?v=4)](https://github.com/kriswallsmith "kriswallsmith (2 commits)")[![makasim](https://avatars.githubusercontent.com/u/143206?v=4)](https://github.com/makasim "makasim (2 commits)")[![roverwolf](https://avatars.githubusercontent.com/u/210211?v=4)](https://github.com/roverwolf "roverwolf (1 commits)")[![albertofem](https://avatars.githubusercontent.com/u/409472?v=4)](https://github.com/albertofem "albertofem (1 commits)")[![EasierLikeThis](https://avatars.githubusercontent.com/u/599341?v=4)](https://github.com/EasierLikeThis "EasierLikeThis (1 commits)")[![jakzal](https://avatars.githubusercontent.com/u/190447?v=4)](https://github.com/jakzal "jakzal (1 commits)")[![jmikola](https://avatars.githubusercontent.com/u/244663?v=4)](https://github.com/jmikola "jmikola (1 commits)")[![akucherenko](https://avatars.githubusercontent.com/u/1897949?v=4)](https://github.com/akucherenko "akucherenko (1 commits)")

---

Tags

composerecommercegooglegoogle-adwordsgoogle-analyticsgoogle-mapsgooglebundlephpsymfony-bundletwiggooglemapsanalyticsantimattradwords

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/meinfernbus-google-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/meinfernbus-google-bundle/health.svg)](https://phpackages.com/packages/meinfernbus-google-bundle)
```

###  Alternatives

[a2lix/auto-form-bundle

Automate form building

873.8M11](/packages/a2lix-auto-form-bundle)[kreait/firebase-bundle

Symfony Bundle for the Firebase Admin SDK

1534.7M2](/packages/kreait-firebase-bundle)[cmen/google-charts-bundle

This Bundle provides a Twig extension and PHP objects to display Google charts in your Symfony application.

76844.8k2](/packages/cmen-google-charts-bundle)[iq2i/storia-bundle

UI Storia bundle

144.6k](/packages/iq2i-storia-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
