hangarx 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +152 -1
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 68fb5a44f579f4f336f4f63f73f20a1a879fc1beda7b4511bb0a8dcaa11c2923
4
- data.tar.gz: dd2417a945455c958e16f4860c585c69eb89422d1fd1a0e2c23cbb558e1da51a
3
+ metadata.gz: 5f5f6cd43788a0b3ba64f4094bcd3e5742f74051bc98f96e7df88d83dbbc6cbe
4
+ data.tar.gz: 9b65fbec9f2f49bbe2ee2e4c265859d76290696d9c2414763ff04df8ba0864a3
5
5
  SHA512:
6
- metadata.gz: cee585156d868525dfe51e7a60086234a157b50d0232f34d689f707f3eae1851901cdd71535e72db50bd88c4c4949909100ae54a90092e4b5646b90dd907ed22
7
- data.tar.gz: 91debdb39accc97b1af8380566baf65f2d3c2cd66a62c21a3f23221428583778ca5cf2ea2391113015624a4861e7eaa79033ace3a041ea0abfbde12fa5631c61
6
+ metadata.gz: 7d2d59143945e8f3c0b460930e6a948165815fe55f3b87345c22806b6b359a45138df66a050f433edac3dc79b93ff921f7521088fb23660150757431a2ab2d33
7
+ data.tar.gz: 177c3f139635cfb39869d642b84fa0e6d7dbf94e843ec951149e1c875fc33b6571f592590031a085137bbf90e01dbe3897912f116b0db68cea0afea1d62f26f0
data/README.md CHANGED
@@ -81,7 +81,158 @@ hangarx.page(
81
81
  )
82
82
  ```
83
83
 
84
- ### 3. Use Growth OS Features
84
+ ### 3. Multi-Tenancy Tracking
85
+
86
+ Track analytics across Organizations, Teams, Client Accounts, and Projects by adding context to your events.
87
+
88
+ #### Hierarchy Structure
89
+
90
+ ```
91
+ Organizations (Partners/Agencies)
92
+
93
+ Teams (Collaboration Units)
94
+
95
+ Client Accounts (Business Entities)
96
+
97
+ Projects (Websites/Apps)
98
+
99
+ Events (User Actions)
100
+ ```
101
+
102
+ #### Adding Multi-Tenancy Context
103
+
104
+ ```ruby
105
+ # Track event with full context
106
+ hangarx.track(
107
+ user_id: 'user-123',
108
+ event: 'api_request',
109
+ properties: {
110
+ endpoint: '/api/users',
111
+ method: 'POST',
112
+ response_time: 145,
113
+
114
+ # Multi-tenancy context
115
+ organization_id: 'org_marketing_agency',
116
+ team_id: 'team_client_services',
117
+ client_account_id: 'client_acme_corp',
118
+ project_id: 'proj_acme_website'
119
+ }
120
+ )
121
+
122
+ # Identify user with context
123
+ hangarx.identify(
124
+ user_id: 'user-123',
125
+ traits: {
126
+ email: 'user@example.com',
127
+ name: 'John Doe',
128
+
129
+ # Multi-tenancy context
130
+ organization_id: 'org_marketing_agency',
131
+ team_id: 'team_client_services',
132
+ role: 'admin'
133
+ }
134
+ )
135
+ ```
136
+
137
+ #### Use Cases
138
+
139
+ **Partner Agency Managing Multiple Clients:**
140
+
141
+ ```ruby
142
+ AGENCY_CONTEXT = {
143
+ organization_id: 'org_marketing_agency',
144
+ team_id: 'team_client_services'
145
+ }
146
+
147
+ # Client 1: E-commerce Store
148
+ hangarx.track(
149
+ user_id: 'user-123',
150
+ event: 'product_viewed',
151
+ properties: {
152
+ product_id: 'prod_456',
153
+ **AGENCY_CONTEXT,
154
+ client_account_id: 'client_ecommerce',
155
+ project_id: 'proj_store_website'
156
+ }
157
+ )
158
+
159
+ # Client 2: SaaS Company
160
+ hangarx.track(
161
+ user_id: 'user-789',
162
+ event: 'signup_completed',
163
+ properties: {
164
+ plan: 'pro',
165
+ **AGENCY_CONTEXT,
166
+ client_account_id: 'client_saas',
167
+ project_id: 'proj_saas_app'
168
+ }
169
+ )
170
+ ```
171
+
172
+ **Consultant Managing Client Projects:**
173
+
174
+ ```ruby
175
+ CONSULTANT_CONTEXT = {
176
+ team_id: 'team_john_consulting',
177
+ consultant_id: 'user_john'
178
+ }
179
+
180
+ # Client A: Restaurant
181
+ hangarx.track(
182
+ user_id: 'visitor-123',
183
+ event: 'reservation_made',
184
+ properties: {
185
+ date: '2025-10-15',
186
+ party_size: 4,
187
+ **CONSULTANT_CONTEXT,
188
+ client_account_id: 'client_restaurant',
189
+ project_id: 'proj_restaurant_site'
190
+ }
191
+ )
192
+ ```
193
+
194
+ #### Helper Module
195
+
196
+ Create a reusable context module:
197
+
198
+ ```ruby
199
+ module AnalyticsContext
200
+ def self.build(org_id: nil, team_id: nil, client_id: nil, project_id: nil)
201
+ {}.tap do |ctx|
202
+ ctx[:organization_id] = org_id if org_id
203
+ ctx[:team_id] = team_id if team_id
204
+ ctx[:client_account_id] = client_id if client_id
205
+ ctx[:project_id] = project_id if project_id
206
+ end
207
+ end
208
+
209
+ def self.track(user_id:, event:, properties: {}, **context_params)
210
+ context = build(**context_params)
211
+ HangarX.track(
212
+ user_id: user_id,
213
+ event: event,
214
+ properties: properties.merge(context)
215
+ )
216
+ end
217
+ end
218
+
219
+ # Usage
220
+ AnalyticsContext.track(
221
+ user_id: 'user-123',
222
+ event: 'button_clicked',
223
+ properties: { button: 'signup' },
224
+ org_id: 'org_abc',
225
+ team_id: 'team_xyz',
226
+ client_id: 'client_def',
227
+ project_id: 'proj_ghi'
228
+ )
229
+ ```
230
+
231
+ For complete multi-tenancy documentation, see [SDK_MULTI_TENANCY_TRACKING.md](../../SDK_MULTI_TENANCY_TRACKING.md)
232
+
233
+ ---
234
+
235
+ ### 4. Use Growth OS Features
85
236
 
86
237
  ```ruby
87
238
  # Ask analytics questions
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hangarx
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - HangarX Team