Skip to content

Instantly share code, notes, and snippets.

@onesup
Created February 18, 2014 07:37
Show Gist options
  • Save onesup/9066251 to your computer and use it in GitHub Desktop.
Save onesup/9066251 to your computer and use it in GitHub Desktop.
gabba 적용
class HomeController < ApplicationController
def switch
tracking_id = Rails.application.secrets.ga_tracking_id
url = Rails.application.secrets.url
Gabba::Gabba.new(tracking_id, url).page_view("pc/mobile switch page", "/")
user_agent = UserAgent.parse(request.user_agent)
if user_agent.mobile?
redirect_to mobile_index_path({s: params[:s]})
else
redirect_to home_index_path({s: params[:s]})
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment