gamobile

Created: 2011-07-07 03:57
Updated: 2018-04-19 18:58
License: mit

README.md

gamobile

gamobile is Google Analytics for japanese mobile with rails 3. This gem rewrite ga.php to rails with jpmobile. So, require rails 3 and jpmobile.

Install

Add gamobile to the :development groups in the Gemfile.

group :development do
  gem "gamobile", :git => "git://github.com/terut/gamobile.git"
end

Create controller and helper for google analytics.

$ rails g gamobile:install [class_name] [tracking_code]
$ rails g gamobile:install mobile::analytics XX-77777777-77
    create  app/controllers/mobile/analytics_controller.rb
    create  app/helpers/mobile/analytics_helper.rb

Configure

Add gamobile routing in the routes.rb.

namespace 'mobile' do
  match 'ga' => 'analytics#ga'
end

Edit gamobile helper and Confirm your tracking code in options.

# app/helpers/mobile/analytics_helper.rb

def ga_url

# TODO Rewrite url adapted to your routes.rb
# Example:
#   return mobile_ga_path(options)
  return "#" 
end

Add img tag in your views.

# app/views/mobile/foo.html.erb

<img src="<%= ga_url %>" width="1" height="1" />
Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more