Development

Changeset 5307

You must first sign up to be able to contribute.

Changeset 5307

Show
Ignore:
Timestamp:
09/29/07 01:49:02 (2 years ago)
Author:
Kris.Wallsmith
Message:

sfUrchinPlugin Added LICENSE and README files for 0.1.0-beta.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfUrchinPlugin/LICENSE

    r5280 r5307  
     1Copyright (c) 2007 Kris Wallsmith 
     2 
     3Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 
     4 
     5The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 
     6 
     7THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
  • plugins/sfUrchinPlugin/README

    r5280 r5307  
     1= sfUrchinPlugin plugin = 
     2 
     3Easily adds tracking code for [http://www.google.com/analytics Google Analytics] to your presentation layer. 
     4 
     5== Features == 
     6 
     7 * `sfUrchinFilter`: Adds necessary tracking code to the bottom of every HTML page. 
     8 * `UrchinHelper`: Helper functions for adding `urchinTracker` calls to links. 
     9 
     10== Installation == 
     11 
     12 * Install the plugin: 
     13  
     14  {{{ 
     15  ./symfony install-plugin http://plugins.symfony-project.com/sfUrchinPlugin 
     16  }}} 
     17  
     18 * Configure your Google Analytics account in `app.yml`: 
     19  
     20  {{{ 
     21  prod: 
     22    urchin: 
     23      enabled:     on 
     24      uacct:       UA-XXXXXXX-X # <-- put your site's account number here 
     25     
     26  all: 
     27    urchin: 
     28      enabled:     off 
     29  }}} 
     30  
     31 * Add `sfUrchinFilter` to `filters.yml` just after `rendering`: 
     32  
     33  {{{ 
     34  rendering: ~ 
     35  urchin: 
     36    class: sfUrchinFilter 
     37  web_debug: ~ 
     38  # etc... 
     39  }}} 
     40 
     41== Usage == 
     42 
     43Just by adding the filter and enabling the plugin in `app.yml` your site should begin tracking on your Google Analytics account. Beyond this, there are three more pieces of functionality that allow you finer control over how your site interacts with Google Analytics. 
     44 
     45=== Track a page as a URI other than its own: `sfUrchinToolkit::setUtParam()` === 
     46 
     47  {{{ 
     48  null sfUrchinToolkit::setUtParam(string $utParam) 
     49  }}} 
     50 
     51If any of your actions call any of the `forward` methods, the action that actually renders will likely not be the action referenced in the browser's address bar. This method allows you to specify a URI to send up to Google Analytics once the page is loaded other that what is in the address bar. 
     52 
     53For example, if you want to track how many visitors land on your `error_404_action`, you could call this from inside that action: 
     54 
     55  {{{ 
     56  sfUrchinToolkit::setUtParam('/error/404?page='.$this->getModuleName().'/'.$this->getActionName()); 
     57  }}} 
     58 
     59=== Track clicks on a link: `urchin_link_to()` === 
     60 
     61  {{{ 
     62  string urchin_link_to(string $name, string $internalUri[, string $urchinUri[, array $options]]) 
     63  }}} 
     64 
     65You'll want to use this helper to track outbound links as well as those that go to a local file that doesn't have Google Analytics tracking code at the bottom (e.g. a PDF or image). 
     66 
     67For example, if you want to track a link to the symfony site: 
     68 
     69  {{{ 
     70  <?php use_helper('Urchin') ?> 
     71   
     72  <p> 
     73    For more information, please visit the <?php echo urchin_link_to('symfony project site', 'http://www.symfony-project.com', '/outbound/symfony') ?>. 
     74  </p> 
     75  }}} 
     76 
     77Or to track downloads of a PDF: 
     78 
     79  {{{ 
     80  <?php use_helper('Urchin') ?> 
     81   
     82  <p> 
     83    You can also download <?php echo urchin_link_to('the PDF version', '/doc/the-book.pdf') ?>. 
     84  </p> 
     85  }}} 
     86 
     87=== Track clicks on a Javascript link: `urchin_link_to_function()` === 
     88 
     89  {{{ 
     90  string urchin_link_to_function(string $name, string $function, string $urchinUri[, array $options]) 
     91  }}} 
     92 
     93This helper function will send a call to Google Analytics when your user clicks a Javascript link. For example, if you want to track calls to a link that closes a popup window: 
     94 
     95  {{{ 
     96  <?php use_helper('Urchin') ?> 
     97   
     98  <p><?php echo urchin_link_to_function('close window', 'window.close()', '/popups/mom/close', 'id=closer') ?></p> 
     99  }}} 
     100 
     101== Changelog == 
     102 
     103=== Version 0.1.0-beta === 
     104 
     105 * Initial public release. 
     106 
     107== Maintainers == 
     108 
     109Kris Wallsmith 

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting.
Sensio Labs also supports several large Open-Source projects.