Class: Umami::Client
- Inherits:
-
Object
- Object
- Umami::Client
- Defined in:
- lib/umami/client.rb
Overview
The Client class provides methods to interact with the Umami API.
Instance Attribute Summary collapse
-
#request_timeout ⇒ Object
readonly
Returns the value of attribute request_timeout.
-
#uri_base ⇒ Object
readonly
Returns the value of attribute uri_base.
Instance Method Summary collapse
-
#add_team_user(team_id, user_id, role) ⇒ Hash
Add a user to a team.
-
#admin_teams(params = {}) ⇒ Hash
Get all teams (admin access required, self-hosted only).
-
#admin_users(params = {}) ⇒ Hash
Get all users (admin access required, self-hosted only).
-
#admin_websites(params = {}) ⇒ Hash
Get all websites (admin access required, self-hosted only).
-
#authenticate ⇒ void
Authenticate with the Umami API using username and password.
-
#cloud? ⇒ Boolean
Check if the client is configured for Umami Cloud.
-
#create_report(params = {}) ⇒ Hash
Create a new report.
-
#create_team(name) ⇒ Hash
Create a new team.
-
#create_user(username, password, role, id: nil) ⇒ Hash
Create a new user.
-
#create_website(params = {}) ⇒ Hash
Create a new website.
-
#delete_link(link_id) ⇒ Hash
Delete a link.
-
#delete_pixel(pixel_id) ⇒ Hash
Delete a pixel.
-
#delete_report(report_id) ⇒ Hash
Delete a report.
-
#delete_team(team_id) ⇒ Hash
Delete a team.
-
#delete_team_user(team_id, user_id) ⇒ Hash
Remove a user from a team.
-
#delete_user(user_id) ⇒ Hash
Delete a user.
-
#delete_website(website_id) ⇒ Hash
Delete a website.
-
#event_data_events(website_id, params = {}) ⇒ Object
deprecated
Deprecated.
Use #website_event_data_events instead
-
#event_data_fields(website_id, params = {}) ⇒ Object
deprecated
Deprecated.
Use #website_event_data_fields instead
-
#event_data_stats(website_id, params = {}) ⇒ Object
deprecated
Deprecated.
Use #website_event_data_stats instead
-
#initialize(options = {}) ⇒ Client
constructor
Initialize a new Umami API client.
-
#join_team(access_code) ⇒ Hash
Join a team.
-
#link(link_id) ⇒ Hash
Get a link by ID.
-
#links(params = {}) ⇒ Hash
Get all links.
-
#me ⇒ Hash
Get information about the current authenticated user.
-
#my_teams(params = {}) ⇒ Hash
Get all teams for the current authenticated user.
-
#my_websites(params = {}) ⇒ Hash
Get all websites for the current authenticated user.
-
#pixel(pixel_id) ⇒ Hash
Get a pixel by ID.
-
#pixels(params = {}) ⇒ Hash
Get all pixels.
-
#realtime(website_id) ⇒ Hash
Get realtime stats for a website (last 30 minutes).
-
#report(report_id) ⇒ Hash
Get a report by ID.
-
#report_attribution(params = {}) ⇒ Hash
Run an attribution report.
-
#report_breakdown(params = {}) ⇒ Hash
Run a breakdown report.
-
#report_funnel(params = {}) ⇒ Hash
Run a funnel report.
-
#report_goals(params = {}) ⇒ Hash
Run a goals report.
-
#report_journey(params = {}) ⇒ Hash
Run a journey report.
-
#report_retention(params = {}) ⇒ Hash
Run a retention report.
-
#report_revenue(params = {}) ⇒ Hash
Run a revenue report.
-
#report_utm(params = {}) ⇒ Hash
Run a UTM report.
-
#reports(params = {}) ⇒ Hash
Get all reports.
-
#reset_website(website_id) ⇒ Hash
Reset a website's data.
-
#self_hosted? ⇒ Boolean
Check if the client is configured for a self-hosted Umami instance.
-
#send_event(payload, user_agent: default_user_agent) ⇒ Hash
Send an event to Umami.
-
#team(team_id) ⇒ Hash
Get a team by ID.
-
#team_user(team_id, user_id) ⇒ Hash
Get a user in a team.
-
#team_users(team_id, params = {}) ⇒ Hash
Get all users in a team.
-
#team_websites(team_id, params = {}) ⇒ Hash
Get all websites for a team.
-
#teams(params = {}) ⇒ Hash
Get all teams.
-
#update_link(link_id, params = {}) ⇒ Hash
Update a link.
-
#update_pixel(pixel_id, params = {}) ⇒ Hash
Update a pixel.
-
#update_report(report_id, params = {}) ⇒ Hash
Update a report.
-
#update_team(team_id, params = {}) ⇒ Hash
Update a team.
-
#update_team_user(team_id, user_id, role) ⇒ Hash
Update a user's role in a team.
-
#update_user(user_id, params = {}) ⇒ Hash
Update a user.
-
#update_website(website_id, params = {}) ⇒ Hash
Update a website.
-
#user(user_id) ⇒ Hash
Get a user by ID.
-
#user_teams(user_id, params = {}) ⇒ Hash
Get all teams for a user.
-
#user_websites(user_id, params = {}) ⇒ Hash
Get all websites for a user.
-
#users(params = {}) ⇒ Hash
deprecated
Deprecated.
Use #admin_users instead
-
#verify_token ⇒ Hash
Verify the authentication token.
-
#website(website_id) ⇒ Hash
Get a website by ID.
-
#website_active_visitors(website_id) ⇒ Hash
Get active visitors for a website (last 5 minutes).
-
#website_event_data(website_id, event_id) ⇒ Array<Hash>
Get event data for an individual event.
-
#website_event_data_events(website_id, params = {}) ⇒ Array<Hash>
Get event data names, properties, and counts.
-
#website_event_data_fields(website_id, params = {}) ⇒ Array<Hash>
Get event data fields within a time range.
-
#website_event_data_properties(website_id, params = {}) ⇒ Array<Hash>
Get event name and property counts.
-
#website_event_data_stats(website_id, params = {}) ⇒ Array<Hash>
Get aggregated event statistics.
-
#website_event_data_values(website_id, params = {}) ⇒ Array<Hash>
Get event data value counts for a given event and property.
-
#website_events(website_id, params = {}) ⇒ Array<Hash>
Get website events within a time range.
-
#website_events_list(website_id, params = {}) ⇒ Hash
Get website event details within a time range (paginated list).
-
#website_events_series(website_id, params = {}) ⇒ Array<Hash>
Get website events series within a time range.
-
#website_metrics(website_id, params = {}) ⇒ Array<Hash>
Get website metrics.
-
#website_metrics_expanded(website_id, params = {}) ⇒ Array<Hash>
Get expanded website metrics with detailed engagement data.
-
#website_pageviews(website_id, params = {}) ⇒ Hash
Get website pageviews within a time range.
-
#website_session(website_id, session_id) ⇒ Hash
Get details for an individual session.
-
#website_session_activity(website_id, session_id, params = {}) ⇒ Array<Hash>
Get activity for an individual session.
-
#website_session_data_properties(website_id, params = {}) ⇒ Array<Hash>
Get session data property counts.
-
#website_session_data_values(website_id, params = {}) ⇒ Array<Hash>
Get session data value counts for a property.
-
#website_session_properties(website_id, session_id) ⇒ Array<Hash>
Get properties for an individual session.
-
#website_sessions(website_id, params = {}) ⇒ Hash
Get website sessions within a time range.
-
#website_sessions_stats(website_id, params = {}) ⇒ Hash
Get summarized session statistics.
-
#website_sessions_weekly(website_id, params = {}) ⇒ Array<Array>
Get session counts by hour of weekday.
-
#website_stats(website_id, params = {}) ⇒ Hash
Get website statistics.
-
#websites(params = {}) ⇒ Hash
Get all websites.
Constructor Details
#initialize(options = {}) ⇒ Client
Initialize a new Umami API client
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/umami/client.rb', line 19 def initialize( = {}) @config = [:config] || Umami.configuration @config.validate! # Validate the configuration before using it @uri_base = [:uri_base] || @config.uri_base @request_timeout = [:request_timeout] || @config.request_timeout @access_token = [:access_token] || @config.access_token @username = [:username] || @config.username @password = [:password] || @config.password authenticate if @access_token.nil? end |
Instance Attribute Details
#request_timeout ⇒ Object (readonly)
Returns the value of attribute request_timeout.
9 10 11 |
# File 'lib/umami/client.rb', line 9 def request_timeout @request_timeout end |
#uri_base ⇒ Object (readonly)
Returns the value of attribute uri_base.
9 10 11 |
# File 'lib/umami/client.rb', line 9 def uri_base @uri_base end |
Instance Method Details
#add_team_user(team_id, user_id, role) ⇒ Hash
Add a user to a team
334 335 336 |
# File 'lib/umami/client.rb', line 334 def add_team_user(team_id, user_id, role) post("/api/teams/#{team_id}/users", { userId: user_id, role: role }) end |
#admin_teams(params = {}) ⇒ Hash
Get all teams (admin access required, self-hosted only)
163 164 165 |
# File 'lib/umami/client.rb', line 163 def admin_teams(params = {}) get("/api/admin/teams", params) end |
#admin_users(params = {}) ⇒ Hash
Get all users (admin access required, self-hosted only)
139 140 141 |
# File 'lib/umami/client.rb', line 139 def admin_users(params = {}) get("/api/admin/users", params) end |
#admin_websites(params = {}) ⇒ Hash
Get all websites (admin access required, self-hosted only)
151 152 153 |
# File 'lib/umami/client.rb', line 151 def admin_websites(params = {}) get("/api/admin/websites", params) end |
#authenticate ⇒ void
This method returns an undefined value.
Authenticate with the Umami API using username and password
This method is called automatically when initializing the client if an access token is not provided. It sets the @access_token instance variable upon successful authentication.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/umami/client.rb', line 66 def authenticate raise Umami::AuthenticationError, "Username and password are required for authentication" if @username.nil? || @password.nil? response = connection.post("/api/auth/login") do |req| req.body = { username: @username, password: @password }.to_json end data = JSON.parse(response.body) @access_token = data["token"] # Umami answers a successful login with { "token": ..., "user": ... } # (https://umami.is/docs/api/authentication#post-/api/auth/login). # A 200 without a token would otherwise produce a client that fails # every request with an opaque 401 — fail loudly at the source. if @access_token.nil? || @access_token.empty? raise Umami::AuthenticationError, "Authentication succeeded but the response carried no token" end # ⚠️ Load-bearing reset. The login POST above just memoized # `@connection` — necessarily WITHOUT an Authorization header, since # `@access_token` was still nil when the connection was built, and # Faraday bakes headers into the connection at build time. Dropping # the memo forces the next request to rebuild the connection, this # time with the Bearer token (see #connection). Without this reset, # every request after a username/password login fails with 401 — # the exact bug shipped in <= 0.2.0 (why token-based auth was the # only flow that worked against self-hosted instances). @connection = nil rescue Faraday::Error, JSON::ParserError => e raise Umami::AuthenticationError, "Authentication failed: #{e.}" end |
#cloud? ⇒ Boolean
Check if the client is configured for Umami Cloud
37 38 39 |
# File 'lib/umami/client.rb', line 37 def cloud? @uri_base == Umami::Configuration::UMAMI_CLOUD_URL end |
#create_report(params = {}) ⇒ Hash
Create a new report
1114 1115 1116 |
# File 'lib/umami/client.rb', line 1114 def create_report(params = {}) post("/api/reports", params) end |
#create_team(name) ⇒ Hash
Create a new team
260 261 262 |
# File 'lib/umami/client.rb', line 260 def create_team(name) post("/api/teams", { name: name }) end |
#create_user(username, password, role, id: nil) ⇒ Hash
Create a new user
177 178 179 180 181 |
# File 'lib/umami/client.rb', line 177 def create_user(username, password, role, id: nil) params = { username: username, password: password, role: role } params[:id] = id if id post("/api/users", params) end |
#create_website(params = {}) ⇒ Hash
Create a new website
407 408 409 |
# File 'lib/umami/client.rb', line 407 def create_website(params = {}) post("/api/websites", params) end |
#delete_link(link_id) ⇒ Hash
Delete a link
1041 1042 1043 |
# File 'lib/umami/client.rb', line 1041 def delete_link(link_id) delete("/api/links/#{link_id}") end |
#delete_pixel(pixel_id) ⇒ Hash
Delete a pixel
1085 1086 1087 |
# File 'lib/umami/client.rb', line 1085 def delete_pixel(pixel_id) delete("/api/pixels/#{pixel_id}") end |
#delete_report(report_id) ⇒ Hash
Delete a report
1145 1146 1147 |
# File 'lib/umami/client.rb', line 1145 def delete_report(report_id) delete("/api/reports/#{report_id}") end |
#delete_team(team_id) ⇒ Hash
Delete a team
310 311 312 |
# File 'lib/umami/client.rb', line 310 def delete_team(team_id) delete("/api/teams/#{team_id}") end |
#delete_team_user(team_id, user_id) ⇒ Hash
Remove a user from a team
365 366 367 |
# File 'lib/umami/client.rb', line 365 def delete_team_user(team_id, user_id) delete("/api/teams/#{team_id}/users/#{user_id}") end |
#delete_user(user_id) ⇒ Hash
Delete a user
223 224 225 |
# File 'lib/umami/client.rb', line 223 def delete_user(user_id) delete("/api/users/#{user_id}") end |
#delete_website(website_id) ⇒ Hash
Delete a website
438 439 440 |
# File 'lib/umami/client.rb', line 438 def delete_website(website_id) delete("/api/websites/#{website_id}") end |
#event_data_events(website_id, params = {}) ⇒ Object
Use #website_event_data_events instead
972 973 974 975 |
# File 'lib/umami/client.rb', line 972 def event_data_events(website_id, params = {}) warn "[DEPRECATION] `event_data_events` is deprecated. Use `website_event_data_events` instead." website_event_data_events(website_id, params) end |
#event_data_fields(website_id, params = {}) ⇒ Object
Use #website_event_data_fields instead
978 979 980 981 |
# File 'lib/umami/client.rb', line 978 def event_data_fields(website_id, params = {}) warn "[DEPRECATION] `event_data_fields` is deprecated. Use `website_event_data_fields` instead." website_event_data_fields(website_id, params) end |
#event_data_stats(website_id, params = {}) ⇒ Object
Use #website_event_data_stats instead
984 985 986 987 |
# File 'lib/umami/client.rb', line 984 def event_data_stats(website_id, params = {}) warn "[DEPRECATION] `event_data_stats` is deprecated. Use `website_event_data_stats` instead." website_event_data_stats(website_id, params) end |
#join_team(access_code) ⇒ Hash
Join a team
280 281 282 |
# File 'lib/umami/client.rb', line 280 def join_team(access_code) post("/api/teams/join", { accessCode: access_code }) end |
#link(link_id) ⇒ Hash
Get a link by ID
1019 1020 1021 |
# File 'lib/umami/client.rb', line 1019 def link(link_id) get("/api/links/#{link_id}") end |
#links(params = {}) ⇒ Hash
Get all links
1010 1011 1012 |
# File 'lib/umami/client.rb', line 1010 def links(params = {}) get("/api/links", params) end |
#me ⇒ Hash
Get information about the current authenticated user
104 105 106 |
# File 'lib/umami/client.rb', line 104 def me get("/api/me") end |
#my_teams(params = {}) ⇒ Hash
Get all teams for the current authenticated user
115 116 117 |
# File 'lib/umami/client.rb', line 115 def my_teams(params = {}) get("/api/me/teams", params) end |
#my_websites(params = {}) ⇒ Hash
Get all websites for the current authenticated user
125 126 127 |
# File 'lib/umami/client.rb', line 125 def my_websites(params = {}) get("/api/me/websites", params) end |
#pixel(pixel_id) ⇒ Hash
Get a pixel by ID
1064 1065 1066 |
# File 'lib/umami/client.rb', line 1064 def pixel(pixel_id) get("/api/pixels/#{pixel_id}") end |
#pixels(params = {}) ⇒ Hash
Get all pixels
1055 1056 1057 |
# File 'lib/umami/client.rb', line 1055 def pixels(params = {}) get("/api/pixels", params) end |
#realtime(website_id) ⇒ Hash
Get realtime stats for a website (last 30 minutes)
996 997 998 |
# File 'lib/umami/client.rb', line 996 def realtime(website_id) get("/api/realtime/#{website_id}") end |
#report(report_id) ⇒ Hash
Get a report by ID
1123 1124 1125 |
# File 'lib/umami/client.rb', line 1123 def report(report_id) get("/api/reports/#{report_id}") end |
#report_attribution(params = {}) ⇒ Hash
Run an attribution report
1161 1162 1163 |
# File 'lib/umami/client.rb', line 1161 def report_attribution(params = {}) post("/api/reports/attribution", params) end |
#report_breakdown(params = {}) ⇒ Hash
Run a breakdown report
1175 1176 1177 |
# File 'lib/umami/client.rb', line 1175 def report_breakdown(params = {}) post("/api/reports/breakdown", params) end |
#report_funnel(params = {}) ⇒ Hash
Run a funnel report
1190 1191 1192 |
# File 'lib/umami/client.rb', line 1190 def report_funnel(params = {}) post("/api/reports/funnel", params) end |
#report_goals(params = {}) ⇒ Hash
Run a goals report
1205 1206 1207 |
# File 'lib/umami/client.rb', line 1205 def report_goals(params = {}) post("/api/reports/goals", params) end |
#report_journey(params = {}) ⇒ Hash
Run a journey report
1221 1222 1223 |
# File 'lib/umami/client.rb', line 1221 def report_journey(params = {}) post("/api/reports/journey", params) end |
#report_retention(params = {}) ⇒ Hash
Run a retention report
1235 1236 1237 |
# File 'lib/umami/client.rb', line 1235 def report_retention(params = {}) post("/api/reports/retention", params) end |
#report_revenue(params = {}) ⇒ Hash
Run a revenue report
1250 1251 1252 |
# File 'lib/umami/client.rb', line 1250 def report_revenue(params = {}) post("/api/reports/revenue", params) end |
#report_utm(params = {}) ⇒ Hash
Run a UTM report
1263 1264 1265 |
# File 'lib/umami/client.rb', line 1263 def report_utm(params = {}) post("/api/reports/utm", params) end |
#reports(params = {}) ⇒ Hash
Get all reports
1100 1101 1102 |
# File 'lib/umami/client.rb', line 1100 def reports(params = {}) get("/api/reports", params) end |
#reset_website(website_id) ⇒ Hash
Reset a website's data
447 448 449 |
# File 'lib/umami/client.rb', line 447 def reset_website(website_id) post("/api/websites/#{website_id}/reset") end |
#self_hosted? ⇒ Boolean
Check if the client is configured for a self-hosted Umami instance
44 45 46 |
# File 'lib/umami/client.rb', line 44 def self_hosted? !cloud? end |
#send_event(payload, user_agent: default_user_agent) ⇒ Hash
No authentication required. Uses https://cloud.umami.is for Umami Cloud.
Send an event to Umami
This method uses a separate connection that:
- Does NOT include Authorization header (not required for /api/send)
- Uses https://cloud.umami.is for Umami Cloud (different from the main API URL)
- Includes a User-Agent header (mandatory per API docs)
1292 1293 1294 |
# File 'lib/umami/client.rb', line 1292 def send_event(payload, user_agent: default_user_agent) send_post("/api/send", { type: "event", payload: payload }, user_agent: user_agent) end |
#team(team_id) ⇒ Hash
Get a team by ID
289 290 291 |
# File 'lib/umami/client.rb', line 289 def team(team_id) get("/api/teams/#{team_id}") end |
#team_user(team_id, user_id) ⇒ Hash
Get a user in a team
344 345 346 |
# File 'lib/umami/client.rb', line 344 def team_user(team_id, user_id) get("/api/teams/#{team_id}/users/#{user_id}") end |
#team_users(team_id, params = {}) ⇒ Hash
Get all users in a team
323 324 325 |
# File 'lib/umami/client.rb', line 323 def team_users(team_id, params = {}) get("/api/teams/#{team_id}/users", params) end |
#team_websites(team_id, params = {}) ⇒ Hash
Get all websites for a team
378 379 380 |
# File 'lib/umami/client.rb', line 378 def team_websites(team_id, params = {}) get("/api/teams/#{team_id}/websites", params) end |
#teams(params = {}) ⇒ Hash
Get all teams
271 272 273 |
# File 'lib/umami/client.rb', line 271 def teams(params = {}) get("/api/teams", params) end |
#update_link(link_id, params = {}) ⇒ Hash
Update a link
1032 1033 1034 |
# File 'lib/umami/client.rb', line 1032 def update_link(link_id, params = {}) post("/api/links/#{link_id}", params) end |
#update_pixel(pixel_id, params = {}) ⇒ Hash
Update a pixel
1076 1077 1078 |
# File 'lib/umami/client.rb', line 1076 def update_pixel(pixel_id, params = {}) post("/api/pixels/#{pixel_id}", params) end |
#update_report(report_id, params = {}) ⇒ Hash
Update a report
1136 1137 1138 |
# File 'lib/umami/client.rb', line 1136 def update_report(report_id, params = {}) post("/api/reports/#{report_id}", params) end |
#update_team(team_id, params = {}) ⇒ Hash
Update a team
301 302 303 |
# File 'lib/umami/client.rb', line 301 def update_team(team_id, params = {}) post("/api/teams/#{team_id}", params) end |
#update_team_user(team_id, user_id, role) ⇒ Hash
Update a user's role in a team
355 356 357 |
# File 'lib/umami/client.rb', line 355 def update_team_user(team_id, user_id, role) post("/api/teams/#{team_id}/users/#{user_id}", { role: role }) end |
#update_user(user_id, params = {}) ⇒ Hash
Update a user
214 215 216 |
# File 'lib/umami/client.rb', line 214 def update_user(user_id, params = {}) post("/api/users/#{user_id}", params) end |
#update_website(website_id, params = {}) ⇒ Hash
Update a website
429 430 431 |
# File 'lib/umami/client.rb', line 429 def update_website(website_id, params = {}) post("/api/websites/#{website_id}", params) end |
#user(user_id) ⇒ Hash
Get a user by ID
201 202 203 |
# File 'lib/umami/client.rb', line 201 def user(user_id) get("/api/users/#{user_id}") end |
#user_teams(user_id, params = {}) ⇒ Hash
Get all teams for a user
249 250 251 |
# File 'lib/umami/client.rb', line 249 def user_teams(user_id, params = {}) get("/api/users/#{user_id}/teams", params) end |
#user_websites(user_id, params = {}) ⇒ Hash
Get all websites for a user
237 238 239 |
# File 'lib/umami/client.rb', line 237 def user_websites(user_id, params = {}) get("/api/users/#{user_id}/websites", params) end |
#users(params = {}) ⇒ Hash
Use #admin_users instead
Get all users (admin access required)
192 193 194 |
# File 'lib/umami/client.rb', line 192 def users(params = {}) admin_users(params) end |
#verify_token ⇒ Hash
Verify the authentication token
52 53 54 |
# File 'lib/umami/client.rb', line 52 def verify_token post("/api/auth/verify") end |
#website(website_id) ⇒ Hash
Get a website by ID
416 417 418 |
# File 'lib/umami/client.rb', line 416 def website(website_id) get("/api/websites/#{website_id}") end |
#website_active_visitors(website_id) ⇒ Hash
Get active visitors for a website (last 5 minutes)
484 485 486 |
# File 'lib/umami/client.rb', line 484 def website_active_visitors(website_id) get("/api/websites/#{website_id}/active") end |
#website_event_data(website_id, event_id) ⇒ Array<Hash>
Get event data for an individual event
832 833 834 |
# File 'lib/umami/client.rb', line 832 def website_event_data(website_id, event_id) get("/api/websites/#{website_id}/event-data/#{event_id}") end |
#website_event_data_events(website_id, params = {}) ⇒ Array<Hash>
Get event data names, properties, and counts
859 860 861 |
# File 'lib/umami/client.rb', line 859 def website_event_data_events(website_id, params = {}) get("/api/websites/#{website_id}/event-data/events", params) end |
#website_event_data_fields(website_id, params = {}) ⇒ Array<Hash>
Get event data fields within a time range
885 886 887 |
# File 'lib/umami/client.rb', line 885 def website_event_data_fields(website_id, params = {}) get("/api/websites/#{website_id}/event-data/fields", params) end |
#website_event_data_properties(website_id, params = {}) ⇒ Array<Hash>
Get event name and property counts
911 912 913 |
# File 'lib/umami/client.rb', line 911 def website_event_data_properties(website_id, params = {}) get("/api/websites/#{website_id}/event-data/properties", params) end |
#website_event_data_stats(website_id, params = {}) ⇒ Array<Hash>
Get aggregated event statistics
965 966 967 |
# File 'lib/umami/client.rb', line 965 def website_event_data_stats(website_id, params = {}) get("/api/websites/#{website_id}/event-data/stats", params) end |
#website_event_data_values(website_id, params = {}) ⇒ Array<Hash>
Get event data value counts for a given event and property
939 940 941 |
# File 'lib/umami/client.rb', line 939 def website_event_data_values(website_id, params = {}) get("/api/websites/#{website_id}/event-data/values", params) end |
#website_events(website_id, params = {}) ⇒ Array<Hash>
Get website events within a time range
This method returns event data with optional time-series grouping. For paginated event lists with search, use #website_events_list instead.
530 531 532 |
# File 'lib/umami/client.rb', line 530 def website_events(website_id, params = {}) get("/api/websites/#{website_id}/events", params) end |
#website_events_list(website_id, params = {}) ⇒ Hash
Get website event details within a time range (paginated list)
This method returns a paginated list of individual events with full details and supports search and filtering. For time-series grouped event data, use #website_events or #website_events_series instead.
822 823 824 |
# File 'lib/umami/client.rb', line 822 def website_events_list(website_id, params = {}) get("/api/websites/#{website_id}/events", params) end |
#website_events_series(website_id, params = {}) ⇒ Array<Hash>
Get website events series within a time range
557 558 559 |
# File 'lib/umami/client.rb', line 557 def website_events_series(website_id, params = {}) get("/api/websites/#{website_id}/events/series", params) end |
#website_metrics(website_id, params = {}) ⇒ Array<Hash>
Get website metrics
586 587 588 |
# File 'lib/umami/client.rb', line 586 def website_metrics(website_id, params = {}) get("/api/websites/#{website_id}/metrics", params) end |
#website_metrics_expanded(website_id, params = {}) ⇒ Array<Hash>
Get expanded website metrics with detailed engagement data
615 616 617 |
# File 'lib/umami/client.rb', line 615 def (website_id, params = {}) get("/api/websites/#{website_id}/metrics/expanded", params) end |
#website_pageviews(website_id, params = {}) ⇒ Hash
Get website pageviews within a time range
512 513 514 |
# File 'lib/umami/client.rb', line 512 def website_pageviews(website_id, params = {}) get("/api/websites/#{website_id}/pageviews", params) end |
#website_session(website_id, session_id) ⇒ Hash
Get details for an individual session
709 710 711 |
# File 'lib/umami/client.rb', line 709 def website_session(website_id, session_id) get("/api/websites/#{website_id}/sessions/#{session_id}") end |
#website_session_activity(website_id, session_id, params = {}) ⇒ Array<Hash>
Get activity for an individual session
722 723 724 |
# File 'lib/umami/client.rb', line 722 def website_session_activity(website_id, session_id, params = {}) get("/api/websites/#{website_id}/sessions/#{session_id}/activity", params) end |
#website_session_data_properties(website_id, params = {}) ⇒ Array<Hash>
Get session data property counts
758 759 760 |
# File 'lib/umami/client.rb', line 758 def website_session_data_properties(website_id, params = {}) get("/api/websites/#{website_id}/session-data/properties", params) end |
#website_session_data_values(website_id, params = {}) ⇒ Array<Hash>
Get session data value counts for a property
785 786 787 |
# File 'lib/umami/client.rb', line 785 def website_session_data_values(website_id, params = {}) get("/api/websites/#{website_id}/session-data/values", params) end |
#website_session_properties(website_id, session_id) ⇒ Array<Hash>
Get properties for an individual session
732 733 734 |
# File 'lib/umami/client.rb', line 732 def website_session_properties(website_id, session_id) get("/api/websites/#{website_id}/sessions/#{session_id}/properties") end |
#website_sessions(website_id, params = {}) ⇒ Hash
Get website sessions within a time range
646 647 648 |
# File 'lib/umami/client.rb', line 646 def website_sessions(website_id, params = {}) get("/api/websites/#{website_id}/sessions", params) end |
#website_sessions_stats(website_id, params = {}) ⇒ Hash
Get summarized session statistics
672 673 674 |
# File 'lib/umami/client.rb', line 672 def website_sessions_stats(website_id, params = {}) get("/api/websites/#{website_id}/sessions/stats", params) end |
#website_sessions_weekly(website_id, params = {}) ⇒ Array<Array>
Get session counts by hour of weekday
699 700 701 |
# File 'lib/umami/client.rb', line 699 def website_sessions_weekly(website_id, params = {}) get("/api/websites/#{website_id}/sessions/weekly", params) end |
#website_stats(website_id, params = {}) ⇒ Hash
Get website statistics
475 476 477 |
# File 'lib/umami/client.rb', line 475 def website_stats(website_id, params = {}) get("/api/websites/#{website_id}/stats", params) end |
#websites(params = {}) ⇒ Hash
Get all websites
393 394 395 |
# File 'lib/umami/client.rb', line 393 def websites(params = {}) get("/api/websites", params) end |