Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Google Analytics Tracking Code For Mobile Written by Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.gitignore
README.markdown
ga.rb
index.rb

README.markdown

Google Analytics Tracking Code For Mobile Written by Ruby

Google Analyticsの携帯用トラッキングコードをRubyで書きました。

ライセンスなお話 http://www.google.com/support/forum/p/webmasters/thread?tid=1fbf97b9f5f82fc0&hl=ja

Version

  • 0.0.1 2010/11/14リリース

Usage

本家の設置の仕方と同じです。

共有ライブラリなどに記述します。 GA_ACCOUNT = "YOUR ACCOUNT HERE" GA_PIXEL = "/ga.rb" def google_analytics_get_image_url url = "" url << GA_PIXEL + "?" url << "utmac=" + GA_ACCOUNT url << "&utmn=" + rand(0x7fffffff).to_s referer = ENV["HTTP_REFERER"] query = ENV["QUERY_STRING"] path = ENV["REQUEST_URI"] unless referer referer = "-" end url << "&utmr=" + CGI.escape(referer) if path url << "&utmp=" + CGI.escape(path) end url << "&guid=ON"

  url.gsub "&", "&amp"
end

Something went wrong with that request. Please try again.