{"id":18874185,"url":"https://github.com/joshuaestes/sfgoogleanalyticsplugin","last_synced_at":"2026-02-17T00:30:19.194Z","repository":{"id":139350863,"uuid":"1374418","full_name":"JoshuaEstes/sfGoogleAnalyticsPlugin","owner":"JoshuaEstes","description":"plugin for symfony 1.4.x that allows you to integrate Google Analytics into your symfony project","archived":false,"fork":false,"pushed_at":"2011-12-06T01:23:51.000Z","size":112,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-31T01:23:59.772Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JoshuaEstes.png","metadata":{"files":{"readme":"README","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-02-16T16:13:18.000Z","updated_at":"2013-12-19T21:05:57.000Z","dependencies_parsed_at":"2023-03-11T14:11:09.993Z","dependency_job_id":null,"html_url":"https://github.com/JoshuaEstes/sfGoogleAnalyticsPlugin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoshuaEstes%2FsfGoogleAnalyticsPlugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoshuaEstes%2FsfGoogleAnalyticsPlugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoshuaEstes%2FsfGoogleAnalyticsPlugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoshuaEstes%2FsfGoogleAnalyticsPlugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JoshuaEstes","download_url":"https://codeload.github.com/JoshuaEstes/sfGoogleAnalyticsPlugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239825074,"owners_count":19703213,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T05:38:23.451Z","updated_at":"2026-02-17T00:30:19.140Z","avatar_url":"https://github.com/JoshuaEstes.png","language":"PHP","readme":"= sfGoogleAnalyticsPlugin plugin =\n\nEasily add [http://www.google.com/analytics Google Analytics] tracking code to your presentation layer.\n\n''This documentation is a work in progress. Thank you for your patience.''\n\n== Installation ==\n\n=== 1. Install ===\n\nYou can install using the `plugin-install` task:\n\n{{{\nphp symfony plugin-install sfGoogleAnalyticsPlugin\n}}}\n\nYou can also pull the code directly from the [http://svn.symfony-project.org/plugins/sfGoogleAnalyticsPlugin/trunk Subversion repository] using a `svn checkout` or the `svn:externals` property on your project's `/plugins` directory.\n\nOnce the plugin code is accessible to your project, you need to add the `sfGoogleAnalyticsFilter` to your filter chain:\n\n{{{\n#!yaml\nrendering: ~\nsecurity:  ~\n\n# insert your own filters here\nsf_google_analytics_plugin:\n  class: sfGoogleAnalyticsFilter\n\ncache:     ~\ncommon:    ~\nexecution: ~\n}}}\n\n''NOTE: This is the symfony 1.1 `filters.yml` file. The equivalent symfony 1.0 file looks slightly different.''\n\n=== 2. Configure ===\n\nBasic configuration is done in your application's `app.yml` file:\n\n{{{\n#!yaml\nall:\n  sf_google_analytics_plugin:\n    enabled:      on\n    profile_id:   XX-XXXXX-X\n    tracker:      google\n}}}\n\nYou'll have to copy the `profile_id` value out of the tracking code Google supplies for your site profile. This value typically starts with the letter U and ends with a single digit.\n\nThis plugin defaults to using the older `urchin` tracker. To take advantage of the latest featureset of Google Analytics, change the `tracker` value to `google`. This will insert the new `ga.js` tracking code into your project.\n\n== Advanced Usage ==\n\nThis plugin provides much more functionality than a simple insert of your tracking code. Here are some highlights:\n\n=== How do I customize the name a page is tracked as? ===\n\nIf you would like to track a certain page as something other than what appears in the browser address bar, you can do so by modifying the `page_name` parameter in `module.yml`:\n\n{{{\n#!yaml\nall:\n  myAction:\n    sf_google_analytics_plugin:\n      params:\n        page_name: something_else\n}}}\n\nFor finer control over when the alternate page name is used, you can access the tracker object directly in your action. This also exposes additional funcionality. \n\n==== Option: `use_flash` ====\n\nFor example, if you want to track a successful form submission for a form that redirects to the same page on success and on error:\n\n{{{\n#!php\n\u003c?php\n\nclass mainActions extends sfActions\n{\n  public function executeContact()\n  {\n    // form submission logic...\n\n    if ($success)\n    {\n      $this-\u003egetTracker()-\u003esetPageName('/contact/success', array(\n        'use_flash' =\u003e true,\n      ));\n\n      $this-\u003esetFlash('feedback', 'Thank you!');\n\n      $this-\u003eredirect('main/contact');\n    }\n  }\n}\n}}}\n\nIn this example, the request after the successful form post will be tracked as `/contact/success`.\n\n==== Option: `is_route` ====\n\nOne more option available is the `is_route` option. When this flag is applied, the string provided for a page name will be passed through `sfRouting` before being added to the page. Using this option allows you to centralize all URLs, those real and for tracking purposes only, in your application's `routing.yml` file:\n\n{{{\n#!yaml\ncontact:\n  url:    /contact\n  param:  { module: main, action: contact }\n\n# be sure the tracking rule comes AFTER the real rule so the application \n# doesn't use it for any url_for('main/contact') calls\ntrack_contact:\n  url:    /contact/success\n  param:  { module: main, action: contact }\n}}}\n\n{{{\n#!php\n\u003c?php\n\nclass mainActions extends sfActions\n{\n  public function executeContact()\n  {\n    // form submission logic...\n\n    if ($success)\n    {\n      $this-\u003egetTracker()-\u003esetPageName('@track_contact', array(\n        'use_flash' =\u003e true,\n        'is_route'  =\u003e true,\n      ));\n\n      $this-\u003esetFlash('feedback', 'Thank you!');\n\n      $this-\u003eredirect('@contact');\n    }\n  }\n}\n}}}\n\n=== How do I selectively disable tracking? ===\n\nYou can easily configure the tracking code for a single module or even a single action by using the `module.yml` configuration file:\n\n{{{\n#!yaml\nall:\n  # disable tracking for this module...\n  sf_google_analytics_plugin:\n    params:\n      enabled off\n  \n  # ...or for a single action\n  index:\n    sf_google_analytics_plugin:\n      params:\n        enabled off\n}}}\n\nAlternatively, you can access the tracker object directly from inside your action:\n\n{{{\n#!php\n\u003c?php\n\nclass mainActions extends sfActions\n{\n  public function executeIndex()\n  {\n    $this-\u003egetTracker()-\u003esetEnabled(false);\n  }\n}\n}}}\n\n=== Can I insert the tracking code at the top of my page? ===\n\nYou can configure this in `app.yml`:\n\n{{{\n#!yaml\nall:\n  sf_google_analytics_plugin:\n    profile_id:   XX-XXXXX-X\n    insertion:    top\n}}}\n\n=== Can I track demographic information? ===\n\nYou can expose whatever information you store on your users (that your privacy policy allows, of course) to Google Analytics. This is best done in your sign-in routine. For example, if you're using [wiki:sfGuardPlugin]:\n\n{{{\n#!php\n\u003c?php\n\nclass myUser extends sfGuardSecurityUser\n{\n  /**\n   * Overload to add custom tracking variables to the current user.\n   * \n   * Variables are added using flash, assuming sign in will be followed by a \n   * redirect.\n   * \n   * @see sfGuardSecurityUser\n   */\n  public function signIn($user, $remember = false, $con = null)\n  {\n    parent::signIn($user, $remember, $con);\n\n    // assign tracking variables\n    if ($gender = $user-\u003egetProfile()-\u003egetGender())\n    {\n      $this-\u003egetTracker()-\u003esetVar('gender/'.$gender, array(\n        'use_flash' =\u003e true,\n      ));\n    }\n    if ($this-\u003ehasCredential('moderator'))\n    {\n      $this-\u003egetTracker()-\u003esetVar('userType/moderator', array(\n        'use_flash' =\u003e true,\n      ));\n    }\n  }\n}\n}}}\n\n== Changelog ==\n\n=== Version 1.1.2 ===\n\n * Fixed symfony 1.1 compatibility in `sfLogger` interactions.\n\n=== Version 1.1.1 ===\n\n * Fixed Javascript case-sensitivity bug.\n\n=== Version 1.1.0 ===\n\n * '''Added support for new Google Javascript library (`ga.js`).'''\n * Updated API to include more human-readable method names.\n * Added support for tracking e-commerce transactions.\n * Added option to parse tracking argument with `sfRouting`.\n * Added option to defer many tracker calls to the next response, similar to `sfFlash` storage (helpful for redirects).\n\n=== Version 1.0-RC1 ===\n\n * Renamed plugin from sfUrchinPlugin to sfGoogleAnalyticsPlugin.\n\n=== Version 0.3.1-beta ===\n\n * Bugfix to insertion top to accommodate `\u003cbody\u003e` tags with attributes.\n\n=== Version 0.3.0-beta ===\n\n * Broke filter logic into protected methods for easy overloading.\n * Added insertion configuration.\n\n=== Version 0.2.0-beta ===\n\n * Added support for SSL requests.\n * Added mixin methods to actions for easy modification of initialization variables and parameters.\n * Added escaping of Javascript values.\n\n=== Version 0.1.0-beta ===\n\n * Initial public release.\n\n== Maintainers ==\n\nKris Wallsmith\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshuaestes%2Fsfgoogleanalyticsplugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoshuaestes%2Fsfgoogleanalyticsplugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshuaestes%2Fsfgoogleanalyticsplugin/lists"}