Last active
March 8, 2023 17:58
-
-
Save domharrington/d5d50bec5fd4963047604c786ff6acca to your computer and use it in GitHub Desktop.
Metrics Rails Configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "readme/metrics" | |
Rails.application.configure do | |
options = { | |
api_key: "YOUR KEY HERE", | |
reject_params: ['data', 'attributes'] | |
} | |
config.middleware.use Readme::Metrics, options do |env| | |
{ | |
api_key: "guest", | |
label: "Guest User", | |
email: "[email protected]" | |
} | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class JsonController < ApplicationController | |
def index | |
render json: { message: 'hello world', data: { id: '123', attributes: { email: '[email protected]' } } } | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rails.application.routes.draw do | |
get '/', to: 'json#index' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment