PHPackages                             prgtw/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. prgtw/google-bundle

ActiveSymfony-bundle

prgtw/google-bundle
===================

The GoogleBundle adds the ability to add various google-related services to your application. These include Google Analytics, Adwords and Static Maps.

1277PHP

Since Jun 11Pushed 2y ago2 watchersCompare

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

READMEChangelogDependenciesVersions (5)Used By (0)

[![CI](https://github.com/DocPlanner/GoogleBundle/actions/workflows/tests.yml/badge.svg)](https://github.com/DocPlanner/GoogleBundle/actions/workflows/tests.yml)

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

[](#googlebundle)

The GoogleBundle adds the ability to add various google-related services to your application. These include Google Analytics, Adwords and Static Maps.

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

[](#installation)

### Initialize Submodule

[](#initialize-submodule)

```
git submodule add git@github.com:antimattr/GoogleBundle.git src/AntiMattr/GoogleBundle

```

### 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

```

#### 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
            checkout_thanks:
                id:    222222
                label: checkoutThanksLabel
                value: 0

```

#### 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 (The static service does NOT require an API Key):

```
google:
    maps: ~

```

#### Controller

[](#controller-1)

```
use AntiMattr\GoogleBundle\Maps\StaticMap;
use AntiMattr\GoogleBundle\Maps\Marker;

...

$map = new StaticMap();
$map->setId("Paul");
$map->setSize("512x512");
$marker = new Marker();
$marker->setLatitude(40.596631);
$marker->setLongitude(-73.972359);
$map->addMarker($marker);
$this->container->get('google.maps')->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

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 52% of commits — single point of failure

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/69f6df2cde2ee864e1ea5ec591e9a586ed97994c87996944194ef03e2ad63086?d=identicon)[prgTW](/maintainers/prgTW)

---

Top Contributors

[![matthewfitz](https://avatars.githubusercontent.com/u/208401?v=4)](https://github.com/matthewfitz "matthewfitz (52 commits)")[![prgTW](https://avatars.githubusercontent.com/u/203249?v=4)](https://github.com/prgTW "prgTW (22 commits)")[![Czarnolecki](https://avatars.githubusercontent.com/u/2145440?v=4)](https://github.com/Czarnolecki "Czarnolecki (12 commits)")[![pulse00](https://avatars.githubusercontent.com/u/185278?v=4)](https://github.com/pulse00 "pulse00 (7 commits)")[![kriswallsmith](https://avatars.githubusercontent.com/u/33886?v=4)](https://github.com/kriswallsmith "kriswallsmith (2 commits)")[![roverwolf](https://avatars.githubusercontent.com/u/210211?v=4)](https://github.com/roverwolf "roverwolf (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)")[![lbarulski](https://avatars.githubusercontent.com/u/2803144?v=4)](https://github.com/lbarulski "lbarulski (1 commits)")

### Embed Badge

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

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

PHPackages © 2026

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