Skip to content

Commit

Permalink
#187540291 Add: subscription_id, and cleanup extra fields
Browse files Browse the repository at this point in the history
  • Loading branch information
dgilling committed May 2, 2024
1 parent b7488c7 commit aca023a
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 366 deletions.
8 changes: 8 additions & 0 deletions source/includes/_overview.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Overview

### Data Model

The Moesif data model includes two types of events (API Calls and Custom Actions) and three type of entities (Users, Companies, and Subscriptions). A full diagram is below.

![Moesif Data Model](https://docs.moesif.com/images/illustration/product-data-model.svg)

For more info, [view docs on Moesif data structure](https://www.moesif.com/docs/getting-started/overview/).

## Filtering

### Query Params
Expand Down
19 changes: 9 additions & 10 deletions source/includes/collector-api/_actions-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ Replace <i>YOUR_COLLECTOR_APPLICATION_ID</i> with your real Application Id
"user_id": "12345",
"company_id": "67890",
"transaction_id": "a3765025-46ec-45dd-bc83-b136c8d1d257",
"session_token": "XXXXX",
"request": {
"uri": "https://acmeinc.com/pricing",
"user_agent_string": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"
Expand All @@ -62,7 +61,7 @@ Replace <i>YOUR_COLLECTOR_APPLICATION_ID</i> with your real Application Id
curl -X POST https://api.moesif.net/v1/actions \
-H 'Content-Type: application/json' \
-H 'X-Moesif-Application-Id: YOUR_COLLECTOR_APPLICATION_ID' \
-d '{"action_name":"Clicked Sign Up","user_id":"12345","company_id":"67890","session_token":"XXXXX","transaction_id": "a3765025-46ec-45dd-bc83-b136c8d1d257","request":{"uri":"https://acmeinc.com/pricing","user_agent_string":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"},"metadata":{"button_label":"Get Started","sign_up_method":"Google SSO"}}'
-d '{"action_name":"Clicked Sign Up","user_id":"12345","company_id":"67890","transaction_id": "a3765025-46ec-45dd-bc83-b136c8d1d257","request":{"uri":"https://acmeinc.com/pricing","user_agent_string":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"},"metadata":{"button_label":"Get Started","sign_up_method":"Google SSO"}}'
```

```javascript--browser
Expand All @@ -85,8 +84,9 @@ moesif.track('Clicked Sign Up', {
transaction_id | string | false | A random 36 char UUID for this event. If set, Moesif will deduplicate events using this id and ensure idempotency.
action_name | string | __true__ | A recognizable name such as <i>Clicked Sign Up</i> or <i>Purchased Subscription<i>
session_token | string | false | The customer's current session token as a string.
user_id | string | false | The [user](#users) identifier to associate this action with.
company_id | string | false | The [company](#companies) identifier to associate this action with (Helpful for B2B companies).
user_id | string | false | Associate this API call to a [user](#users). Typically, a real person.
company_id | string | false | Associate this API call to a [company](#companies) (Required for metered billing).
subscription_id | string | false | Associate this API call to a specific [subscription](#subscriptions) of a company. Not needed unless same company can have multiple subscriptions to the same plan.
metadata | object | false | An object containing any custom event metadata you want to store with this event.
request |object | __true__ | The object containing the action's request context.
<p style="margin-left:1.5em">time</p> |string(date-time) | false | Timestamp for the action in ISO 8601 format. Set by server automatically if not set.
Expand Down Expand Up @@ -143,7 +143,6 @@ Replace <i>YOUR_COLLECTOR_APPLICATION_ID</i> with your real Application Id
"action_name": "Clicked Sign Up",
"user_id": "12345",
"company_id": "67890",
"session_token": "XXXXX",
"transaction_id": "a3765025-46ec-45dd-bc83-b136c8d1d257",
"request": {
"uri": "https://acmeinc.com/pricing",
Expand All @@ -158,7 +157,6 @@ Replace <i>YOUR_COLLECTOR_APPLICATION_ID</i> with your real Application Id
"action_name": "Purchased Subscription",
"user_id": "12345",
"company_id": "67890",
"session_token": "XXXXX",
"transaction_id": "a90cbabb-2dfc-4290-a368-48ce1a1af7ba",
"request": {
"uri": "https://acmeinc.com/pricing",
Expand All @@ -177,7 +175,7 @@ Replace <i>YOUR_COLLECTOR_APPLICATION_ID</i> with your real Application Id
curl -X POST https://api.moesif.net/v1/actions/batch \
-H 'Content-Type: application/json' \
-H 'X-Moesif-Application-Id: YOUR_COLLECTOR_APPLICATION_ID' \
-d '[{"action_name":"Clicked Sign Up","user_id":"12345","company_id":"67890","session_token":"XXXXX","transaction_id": "a3765025-46ec-45dd-bc83-b136c8d1d257","request":{"uri":"https://acmeinc.com/pricing","user_agent_string":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"},"metadata":{"button_label":"Get Started","sign_up_method":"Google SSO"}},{"action_name":"Purchased Subscription","user_id":"12345","company_id":"67890","session_token":"XXXXX","transaction_id": "a90cbabb-2dfc-4290-a368-48ce1a1af7ba","request":{"uri":"https://acmeinc.com/pricing","user_agent_string":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"},"metadata":{"plan_name":"Pay As You Go","plan_revenue":5000}}]'
-d '[{"action_name":"Clicked Sign Up","user_id":"12345","company_id":"67890","transaction_id": "a3765025-46ec-45dd-bc83-b136c8d1d257","request":{"uri":"https://acmeinc.com/pricing","user_agent_string":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"},"metadata":{"button_label":"Get Started","sign_up_method":"Google SSO"}},{"action_name":"Purchased Subscription","user_id":"12345","company_id":"67890","transaction_id": "a90cbabb-2dfc-4290-a368-48ce1a1af7ba","request":{"uri":"https://acmeinc.com/pricing","user_agent_string":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"},"metadata":{"plan_name":"Pay As You Go","plan_revenue":5000}}]'
```

```javascript--browser
Expand All @@ -197,11 +195,12 @@ moesif.track('Clicked Sign Up', {

|Name|Type|Required|Description|
|-----------|-----------|-----------|-----------|
transaction_id | string | false | A random 36 char UUID for this event. If set, Moesif will deduplicate events using this id and ensure idempotency. Moesif will still deduplicate even accross different size batches.
transaction_id | string | false | A random 36 char UUID for this event. If set, Moesif will deduplicate events using this id and ensure idempotency. Moesif will still deduplicate even across different size batches.
action_name | string | __true__ | A recognizable name such as <i>Clicked Sign Up</i> or <i>Purchased Subscription<i>
session_token | string | false | The customer's current session token as a string.
user_id | string | false | The [user](#users) identifier to associate this action with.
company_id | string | false | The [company](#companies) identifier to associate this action with (Helpful for B2B companies).
user_id | string | false | Associate this API call to a [user](#users). Typically, a real person.
company_id | string | false | Associate this API call to a [company](#companies) (Required for metered billing).
subscription_id | string | false | Associate this API call to a specific [subscription](#subscriptions) of a company. Not needed unless same company can have multiple subscriptions to the same plan.
metadata | object | false | An object containing any custom event metadata you want to store with this event.
request |object | __true__ | The object containing the action's request context.
<p style="margin-left:1.5em">time</p> |string(date-time) | false | Timestamp for the action in ISO 8601 format. Set by server automatically if not set.
Expand Down
Loading

0 comments on commit aca023a

Please sign in to comment.