Skip to content

Commit

Permalink
Minor code style updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jedateach committed Jan 8, 2015
1 parent e95b9e9 commit dd53dd9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
14 changes: 6 additions & 8 deletions README.md
@@ -1,11 +1,9 @@
Shop Google Analytics Tracking
==============================
# Shop Google Analytics Tracking

Setup
-----
Add the following to your yaml config:
## Setup

```
Add the following to your yaml config:
```yaml
ShopGoogleAnalytics:
web_property_id: UA-XXXXXX-X
```
Expand All @@ -23,7 +21,7 @@ Some additional configuration options (all on the ShopGoogleAnalytics object):
* tracking_code - allows finer grained control over the templates used to generate the javascript


TODO / Room for improvement:
----------------------------
## TODO / Room for improvement:

* Optionally allow recording actions: add to cart, remove, set quantity.
* Integrate analtyics reporting into CMS for an order. This way site owners an see additional info for the customer.
5 changes: 4 additions & 1 deletion code/ShopGoogleAnalytics.php
Expand Up @@ -45,7 +45,10 @@ class ShopGoogleAnalytics extends Object
* @return string
*/
public static function get_property_id() {
if (self::config()->disable_on_dev && !\Director::isLive()) return '';
if (self::config()->disable_on_dev && !\Director::isLive()){
return '';
}

return self::config()->web_property_id;
}
}
10 changes: 6 additions & 4 deletions code/ShopGoogleAnalyticsController.php
Expand Up @@ -6,10 +6,9 @@
* @date 09.10.2014
* @package shop_googleanalytics
*/
class ShopGoogleAnalyticsController extends Extension
{
protected $snippets = array();
class ShopGoogleAnalyticsController extends Extension {

protected $snippets = array();

/**
* Add in global analytics code as appropriate
Expand Down Expand Up @@ -73,7 +72,10 @@ public function GAWebProperyID() {
* @return string
*/
public function GoogleAnalyticsJS() {
if (empty($this->snippets)) return '';
if (empty($this->snippets)){
return '';
}

return "<script type=\"text/javascript\">\n" . implode("\n", $this->snippets) . "</script>\n";
}
}

0 comments on commit dd53dd9

Please sign in to comment.