Skip to content

Commit

Permalink
add source property for tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
milukove committed Jul 25, 2023
1 parent 2b96a51 commit b06ec3e
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.0.6] 2022-07-25

### Added

- `source` property for some methods, for events tracking

## [1.0.5] 2022-07-19

### Updated
Expand Down
3 changes: 3 additions & 0 deletions DOCUMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@
| payload.step | <code>Operation</code> | | <p>Workflow step</p> |
| payload.input | <code>Object</code> | | <p>Sample user input</p> |
| [payload.environment] | <code>string</code> | <code>&quot;production&quot;</code> | <p>Specifiy execution environment (<code>production</code> or <code>staging</code>). Optional. Default value <code>production</code>.</p> |
| [payload.source] | <code>string</code> | | <p>The source of event for tracking purposes. Optional.</p> |

<a name="GrinderyClient.Connector+runAction"></a>

Expand All @@ -210,6 +211,7 @@
| payload.step | <code>Operation</code> | <p>Workflow step</p> |
| payload.input | <code>Object</code> | <p>Sample user input</p> |
| [payload.environment] | <code>string</code> | <p>Specifiy execution environment (<code>production</code> or <code>staging</code>). Optional. Default value <code>production</code>.</p> |
| [payload.source] | <code>string</code> | <p>The source of event for tracking purposes. Optional.</p> |

<a name="GrinderyClient.Connector+callInputProvider"></a>

Expand Down Expand Up @@ -397,6 +399,7 @@
| [payload.hutk] | <code>string</code> | <p>The tracking cookie token value used for HubSpot lead activity tracking. You can retrieve this value from the &quot;hubspotutk&quot; cookie placed in the user's browser by the HubSpot JavaScript Tracking Code. (optional)</p> |
| [payload.pageName] | <code>string</code> | <p>The name or title of the page the submission happened on (optional)</p> |
| [payload.ipAddress] | <code>string</code> | <p>The IP address of the visitor filling out the form (optional)</p> |
| [payload.trackSource] | <code>string</code> | <p>The source of event for tracking purposes (optional)</p> |

<a name="GrinderyClient.User+saveWalletAddress"></a>

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.0.5",
"version": "1.0.6",
"license": "MIT",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand Down
8 changes: 8 additions & 0 deletions src/classes/Connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,16 +200,19 @@ class Connector {
* @param {Operation} payload.step - Workflow step
* @param {Object} payload.input - Sample user input
* @param {string} [payload.environment=production] - Specifiy execution environment (`production` or `staging`). Optional. Default value `production`.
* @param {string} [payload.source] - The source of event for tracking purposes. Optional.
* @returns {Promise<Object>} Promise object with action execution payload
*/
async testAction({
step,
input,
environment,
source,
}: {
step: Operation;
input: unknown;
environment?: string;
source?: string;
}): Promise<any> {
if (!this.token) {
throw new Error('Authentication required');
Expand All @@ -226,6 +229,7 @@ class Connector {
step,
input,
environment: environment || 'production',
source: source || 'unknown',
},
this.token
);
Expand All @@ -239,16 +243,19 @@ class Connector {
* @param {Operation} payload.step - Workflow step
* @param {Object} payload.input - Sample user input
* @param {string} [payload.environment] - Specifiy execution environment (`production` or `staging`). Optional. Default value `production`.
* @param {string} [payload.source] - The source of event for tracking purposes. Optional.
* @returns {Promise<Object>} Promise object with action execution payload
*/
async runAction({
step,
input,
environment,
source,
}: {
step: Operation;
input: unknown;
environment?: string;
source?: string;
}): Promise<any> {
if (!this.token) {
throw new Error('Authentication required');
Expand All @@ -265,6 +272,7 @@ class Connector {
step,
input,
environment: environment || 'production',
source: source || 'unknown',
},
this.token
);
Expand Down
4 changes: 4 additions & 0 deletions src/classes/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ class User {
* @param {string} [payload.hutk] - The tracking cookie token value used for HubSpot lead activity tracking. You can retrieve this value from the "hubspotutk" cookie placed in the user's browser by the HubSpot JavaScript Tracking Code. (optional)
* @param {string} [payload.pageName] - The name or title of the page the submission happened on (optional)
* @param {string} [payload.ipAddress] - The IP address of the visitor filling out the form (optional)
* @param {string} [payload.trackSource] - The source of event for tracking purposes (optional)
* @returns {Promise<boolean>} Promise object with `true` on success
*/
async requestEarlyAccess({
Expand All @@ -160,6 +161,7 @@ class User {
hutk,
pageName,
ipAddress,
trackSource,
}: {
email: string;
source?: string;
Expand All @@ -171,6 +173,7 @@ class User {
hutk?: string;
pageName?: string;
ipAddress?: string;
trackSource?: string;
}): Promise<boolean> {
if (!this.token) {
throw new Error('Authentication required');
Expand All @@ -194,6 +197,7 @@ class User {
hutk: hutk || '',
pageName: pageName || '',
ipAddress: ipAddress || '',
trackSource: trackSource || 'unknown',
},
this.token
);
Expand Down

0 comments on commit b06ec3e

Please sign in to comment.