Skip to content

Instantly share code, notes, and snippets.

@jordangraft
Last active April 24, 2016 19:27
Show Gist options
  • Save jordangraft/2e6e224795f15f402ff1a30f5cb6384e to your computer and use it in GitHub Desktop.
Save jordangraft/2e6e224795f15f402ff1a30f5cb6384e to your computer and use it in GitHub Desktop.
Controller action for receiving a ga_id from the client side
class ApplicationController < ActionController::Base
##
# Set the Google Analytics CID as passed via query params
# and then saved onto an order if they convert
def set_ga_id
session[:ga_id] ||= params[:ga_id]
render nothing: true
end
end
post '/set_ga_id', to: "application#set_ga_id"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment