Permalink
Browse files

Test setup was out of date, add page tracking config

  • Loading branch information...
1 parent 1972d01 commit 20bdb4cce81c1c5a2486fdc4ab420be1e6043a49 @matthewfitz matthewfitz committed Jun 29, 2011
View
@@ -10,7 +10,7 @@
class Analytics
{
- const EVENT_QUEUE_KEY = 'google_analytics/event/queue';
+ const EVENT_QUEUE_KEY = 'google_analytics/event/queue';
const CUSTOM_PAGE_VIEW_KEY = 'google_analytics/page_view';
const PAGE_VIEW_QUEUE_KEY = 'google_analytics/page_view/queue';
const TRANSACTION_KEY = 'google_analytics/transaction';
@@ -94,6 +94,34 @@ public function getAllowLinker($trackerKey)
}
/**
+ * @param string $trackerKey
+ * @param boolean $trackPageLoadTime
+ */
+ public function setTrackPageLoadTime($trackerKey, $trackPageLoadTime)
+ {
+ if (!array_key_exists($trackerKey, $this->trackers)) {
+ return;
+ }
+ $this->trackers[$trackerKey]['trackPageLoadTime'] = $trackPageLoadTime;
+ }
+
+ /**
+ * @param string $trackerKey
+ * @return boolean $trackPageLoadTime
+ */
+ public function getTrackPageLoadTime($trackerKey)
+ {
+ if (!array_key_exists($trackerKey, $this->trackers)) {
+ return false;
+ }
+ $trackerConfig = $this->trackers[$trackerKey];
+ if (!array_key_exists('trackPageLoadTime', $trackerConfig)) {
+ return false;
+ }
+ return $trackerConfig['trackPageLoadTime'];
+ }
+
+ /**
* @return string $customPageView
*/
public function getCustomPageView()
@@ -25,6 +25,11 @@ public function getAllowLinker($trackerKey)
return $this->analytics->getAllowLinker($trackerKey);
}
+ public function getTrackPageLoadTime($trackerKey)
+ {
+ return $this->analytics->getTrackPageLoadTime($trackerKey);
+ }
+
public function hasCustomPageView()
{
return $this->analytics->hasCustomPageView();
View
@@ -36,6 +36,7 @@ the application's `config.yml` file:
name: MyJavaScriptCompatibleVariableNameWithNoSpaces
accountId: UA-xxxx-x
domain: .mydomain.com
+ trackPageLoadTime: true
#### View
@@ -43,6 +43,10 @@
}
{% endif %}
+ {% if google_analytics.getTrackPageLoadTime(key) %}
+ _gaq.push(['{{ tracker.name }}._trackPageLoadTime']);
+ {% endif %}
+
{% if google_analytics.isTransactionValid %}
{% set transaction = google_analytics.transaction %}
_gaq.push(['{{ tracker.name }}._addTrans',
@@ -147,4 +147,10 @@ public function testSetAllowLinker()
$this->analytics->setAllowLinker('default', false);
$this->assertFalse($this->analytics->getAllowLinker('default'));
}
+
+ public function testSetTrackPageLoadTime()
+ {
+ $this->analytics->setTrackPageLoadTime('default', true);
+ $this->assertTrue($this->analytics->getTrackPageLoadTime('default'));
+ }
}
@@ -18,11 +18,9 @@ public function registerBundles()
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
- new Symfony\Bundle\ZendBundle\ZendBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Symfony\Bundle\DoctrineBundle\DoctrineBundle(),
new Symfony\Bundle\DoctrineMigrationsBundle\DoctrineMigrationsBundle(),
- new Symfony\Bundle\DoctrineMongoDBBundle\DoctrineMongoDBBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(),
@@ -8,19 +8,16 @@
$loader->registerNamespaces(array(
'Symfony' => $_SERVER['VENDOR_LIB'].'/symfony/src',
'AntiMattr' => __DIR__.'/../../../../',
- 'Doctrine\\ODM\\MongoDB\\Symfony\\SoftDeleteBundle' => $_SERVER['VENDOR_LIB'].'/doctrine-mongodb-odm-softdelete-bundle',
- 'Doctrine\\ODM\\MongoDB\\SoftDelete' => $_SERVER['VENDOR_LIB'].'/doctrine-mongodb-odm-softdelete/lib',
'Doctrine\\Common\\DataFixtures' => $_SERVER['VENDOR_LIB'].'/doctrine-data-fixtures/lib',
'Doctrine\\Common' => $_SERVER['VENDOR_LIB'].'/doctrine-common/lib',
'Doctrine\\DBAL\\Migrations' => $_SERVER['VENDOR_LIB'].'/doctrine-migrations/lib',
'Doctrine\\DBAL' => $_SERVER['VENDOR_LIB'].'/doctrine-dbal/lib',
- 'Doctrine\\MongoDB' => $_SERVER['VENDOR_LIB'].'/doctrine-mongodb/lib',
- 'Doctrine\\ODM\\MongoDB' => $_SERVER['VENDOR_LIB'].'/doctrine-mongodb-odm/lib',
+ 'Doctrine\\ORM' => $_SERVER['VENDOR_LIB'].'/doctrine/lib',
'Zend' => $_SERVER['VENDOR_LIB'].'/zend/library'
));
$loader->registerPrefixes(array(
'Swift_' => $_SERVER['VENDOR_LIB'].'/swiftmailer/lib/classes',
'Twig_' => $_SERVER['VENDOR_LIB'].'/twig/lib'
));
-$loader->registerNamespaceFallback(__DIR__);
+$loader->registerNamespaceFallbacks(array($_SERVER['VENDOR_LIB'].'/bundles'));
$loader->register();
@@ -2,29 +2,18 @@ web_profiler:
toolbar: true
intercept_redirects: true
-services:
- session.storage: @session.storage.array
-
framework:
+ secret: notasecret
charset: UTF-8
- error_handler: false
test: ~
- document_root: "%kernel.root_dir%/../web"
router: { resource: "%kernel.root_dir%/config/routing_test.yml" }
profiler: { only_exceptions: false }
- validation: { enabled: true, annotations: true }
+ validation: { enabled: true, enable_annotations: true }
templating:
assets_version: 0.1
engines: ['twig']
session:
- default_locale: en
- lifetime: 3600
- auto_start: true
-
-zend:
- logger:
- priority: debug
- path: %kernel.logs_dir%/%kernel.environment%.log
+ storage_id: session.storage.filesystem
twig:
debug: %kernel.debug%
@@ -37,6 +26,9 @@ google:
name: MyJavaScriptCompatibleVariableNameWithNoSpaces
accountId: xxxxxx
domain: .example.com
+ allowHash: false
+ allowLinker: true
+ trackPageLoadTime: false
adwords:
conversions:
account_create:

0 comments on commit 20bdb4c

Please sign in to comment.