PageRenderTime 35ms CodeModel.GetById 12ms RepoModel.GetById 1ms app.codeStats 0ms

/baser/views/elements/mobile/google_analytics.php

https://github.com/hashing/basercms
PHP | 44 lines | 23 code | 1 blank | 20 comment | 4 complexity | c9a388fa69ebf3d429cdd8010cf3e78a MD5 | raw file
Possible License(s): MIT
  1. <?php
  2. /* SVN FILE: $Id$ */
  3. /**
  4. * [PUBLISH] モバイル用 Google Analytics 画像タグ
  5. *
  6. * PHP5以上のみ対応
  7. *
  8. * PHP versions 5
  9. *
  10. * baserCMS : Based Website Development Project <http://basercms.net>
  11. * Copyright 2008 - 2012, baserCMS Users Community <http://sites.google.com/site/baserusers/>
  12. *
  13. * @copyright Copyright 2008 - 2012, baserCMS Users Community
  14. * @link http://basercms.net baserCMS Project
  15. * @package baser.views
  16. * @since baserCMS v 0.1.0
  17. * @version $Revision$
  18. * @modifiedby $LastChangedBy$
  19. * @lastmodified $Date$
  20. * @license http://basercms.net/license/index.html
  21. */
  22. ?>
  23. <cake:nocache>
  24. <?php
  25. $baseUrl = "/mobile/ga";
  26. if(!empty($_SERVER["HTTP_REFERER"])) {
  27. $referer = $_SERVER["HTTP_REFERER"];
  28. } else {
  29. $referer = "-";
  30. }
  31. if (!empty($_SERVER["REQUEST_URI"])) {
  32. $path = $_SERVER["REQUEST_URI"];
  33. } else {
  34. $path = '';
  35. }
  36. $url = $baseUrl . "?";
  37. $url .= "&utmn=" . rand(0, 0x7fffffff);
  38. $url .= "&utmr=" . urlencode($referer);
  39. $url .= "&utmp=" . urlencode($path);
  40. $url .= "&guid=ON";
  41. echo '<img src="'.str_replace("&", "&amp;", $url).'" width="1" height="1" />';
  42. ?>
  43. </cake:nocache>