diff --git a/source/includes/collector-api/_actions-api.md b/source/includes/collector-api/_actions-api.md
index cf9da05..ba81dd8 100644
--- a/source/includes/collector-api/_actions-api.md
+++ b/source/includes/collector-api/_actions-api.md
@@ -7,28 +7,13 @@
Log a single action to Moesif.
Actions represent events that occur within your application at a specific point in time. They can be tracked within your UI (such as "User Clicked Sign Up") or from your backend (such as "SMS Job Finished"). Each action consists of a required _Action Name_ and optional _Metadata_.
-
-Actions can be tracked from your frontend app using moesif-browser-js or directly from your backend using this API.
-
-
-**An example tracking actions using moesif-browser-js:**
+
-
-```javascript
-var moesif = require('moesif-browser-js');
-
-moesif.init({
- applicationId: 'YOUR_COLLECTOR_APPLICATION_ID'
-});
+Actions can be tracked from your frontend app using moesif-browser-js
or directly from your backend using this API. You can also use
+Moesif API library for Node.js and
+Moesif Node.js middleware .
-// The first argument (required) contains the action name string.
-// The second argument (optional) contains event metadata.
-moesif.track('Clicked Sign Up', {
- button_label: 'Get Started',
- sign_up_method: 'Google SSO'
-});
-```
-
+
Replace YOUR_COLLECTOR_APPLICATION_ID with your real Application Id
@@ -79,6 +64,35 @@ moesif.track('Clicked Sign Up', {
});
```
+```javascript--nodejs
+var moesifapi = require('moesifapi');
+var apiClient = moesifapi.ApiController;
+
+moesifapi.configuration.ApplicationId = "YOUR_COLLECTOR_APPLICATION_ID";
+
+var action = {
+ transactionId: "a3765025-46ec-45dd-bc83-b136c8d1d257",
+ actionName: "Clicked Sign Up",
+ sessionToken: "23jdf0owekfmcn4u3qypxg08w4d8ayrcdx8nu2nz]s98y18cx98q3yhwmnhcfx43f",
+ userId: "12345",
+ companyId: "67890",
+ metadata: {
+ email: "johndoe@acmeinc.com",
+ button_label: 'Get Started',
+ sign_up_method: 'Google SSO'
+ },
+ request: {
+ time: new Date(),
+ uri: "https://api.acmeinc.com/items/reviews/",
+ ipAddress: "61.48.220.123",
+ }
+};
+// Send the Action
+apiClient.sendAction(new moesifapi.ActionModel(action), function(error, response, context) {
+ // Do Something
+});
+```
+
|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.
@@ -104,28 +118,14 @@ Actions represent events that occur within your application at a specific point
This API accepts an array of actions as the payload
The maximum batch size is **15MB**. Break up larger batches into smaller batches.
-
-Actions can be tracked from your frontend app using moesif-browser-js or directly from your backend using this API.
-
-
-**An example tracking actions using moesif-browser-js:**
+
-
-```javascript
-var moesif = require('moesif-browser-js');
-
-moesif.init({
- applicationId: 'YOUR_COLLECTOR_APPLICATION_ID'
-});
+Actions can be tracked from your frontend app using moesif-browser-js
+or directly from your backend using this API. You can also use
+Moesif API library for Node.js and
+Moesif Node.js middleware .
-// The first argument (required) contains the action name string.
-// The second argument (optional) contains event metadata.
-moesif.track('Clicked Sign Up', {
- button_label: 'Get Started',
- sign_up_method: 'Google SSO'
-});
-```
-
+
Replace YOUR_COLLECTOR_APPLICATION_ID with your real Application Id
@@ -192,6 +192,66 @@ moesif.track('Clicked Sign Up', {
});
```
+```javascript--nodejs
+var moesifapi = require('moesifapi');
+var apiClient = moesifapi.ApiController;
+
+moesifapi.configuration.ApplicationId = "YOUR_COLLECTOR_APPLICATION_ID";
+
+// Define the request context objects for each action.
+var req_contextA = {
+ time: new Date(),
+ uri: "https://api.acmeinc.com/items/reviews/",
+ ipAddress: "61.48.220.123",
+ userAgentString: "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0"
+};
+
+var req_contextB = {
+ time: new Date(),
+ uri: "https://api.acmeinc.com/pricing/",
+ ipAddress: "61.48.220.126",
+ userAgentString: "PostmanRuntime/7.26.5"
+};
+
+// Define the actions.
+var actionA = {
+ transactionId: "a3765025-46ec-45dd-bc83-b136a8d1d357",
+ actionName: "Clicked Sign Up",
+ sessionToken: "23abf0owekfmcn4u3qypxg09w4d8ayrcdx8nu2ng]s98y18cx98q3yhwmnhcfx43f",
+ userId: "18340",
+ companyId: "25100",
+ metadata: {
+ email: "alex@acmeinc.com",
+ button_label: 'Get Started',
+ sign_up_method: 'Google SSO'
+ },
+ request: req_contextA
+};
+
+var actionB = {
+ transactionId: "a3765024-46ee-45dd-bc83-b136c8d1d250",
+ actionName: "Viewed pricing",
+ sessionToken: "23jdf0owejfmbn4u3qypxg09w4d8ayrxdx8nu2ng]s98y18cx98q3yhwmnhcfx43f",
+ userId: "12390",
+ companyId: "97895",
+ metadata: {
+ email: "kim@acmeinc.com",
+ button_label: 'See pricing',
+ sign_up_method: 'Google SSO'
+ },
+ request: req_contextB
+};
+
+var actions = [
+ new moesifapi.ActionModel(actionA),
+ new moesifapi.ActionModel(actionB)
+];
+// Send the batch of Actions
+apiClient.sendActionsBatch(actions, function(error, response, context) {
+ // Do Something
+});
+```
+
|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 across different size batches.