Socket
Socket
Sign inDemoInstall

@highoutput/analytics

Package Overview
Dependencies
Maintainers
5
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@highoutput/analytics - npm Package Compare versions

Comparing version 0.2.2 to 0.3.0

16

dist/analytics.d.ts

@@ -12,13 +12,15 @@ import { Mixpanel } from 'mixpanel';

});
createAccount(params: {
setAccount(params: {
accountId: string;
firstname?: string;
lastname?: string;
email?: string;
created?: Date;
[key: string]: any;
body: {
firstname?: string;
lastname?: string;
email?: string;
created?: Date;
[key: string]: any;
};
}): void;
createEvent(params: {
eventName: string;
accountId: string;
accountId?: string;
body: Record<any, any>;

@@ -25,0 +27,0 @@ }): void;

@@ -32,6 +32,5 @@ "use strict";

}
createAccount(params) {
setAccount(params) {
if (this.status === 'SHUTTING_DOWN')
return;
const extraFields = serialize(ramda_1.default.omit(['accountId', 'firstname', 'lastname', 'email', 'created'], params));
this.queue.add(async () => {

@@ -41,3 +40,3 @@ try {

var _a;
this.driver.people.set(params.accountId.toString(), Object.assign({ $distinct_id: params.accountId.toString(), meta: { project: this.project }, $first_name: params.firstname, $last_name: params.lastname, $email: params.email, $created: (_a = params.created) !== null && _a !== void 0 ? _a : new Date() }, extraFields), (err) => {
this.driver.people.set(params.accountId.toString(), Object.assign({ $distinct_id: params.accountId.toString(), meta: { project: this.project }, $first_name: params.body.firstname, $last_name: params.body.lastname, $email: params.body.email, $created: (_a = params.body.created) !== null && _a !== void 0 ? _a : new Date() }, serialize(ramda_1.default.omit(['accountId', 'firstname', 'lastname', 'email', 'created'], params.body))), (err) => {
if (err) {

@@ -61,3 +60,3 @@ reject(err);

await new Promise((resolve, reject) => {
this.driver.track(params.eventName, Object.assign({ $distinct_id: params.accountId, meta: { project: this.project } }, serialize(params.body)), (err) => {
this.driver.track(params.eventName, Object.assign({ distinct_id: params.accountId, meta: { project: this.project } }, serialize(params.body)), (err) => {
if (err) {

@@ -64,0 +63,0 @@ reject(err);

{
"name": "@highoutput/analytics",
"version": "0.2.2",
"version": "0.3.0",
"description": "Analytics",

@@ -51,3 +51,3 @@ "main": "dist/index.js",

},
"gitHead": "86810b36720697c0a8ef64ed7b8c6d8ac3aa3a11"
"gitHead": "e85bdb1dc7eff8c6a7a35fe1372f67524bebf950"
}

@@ -17,10 +17,15 @@ # analytics

analytics.createAccount({
// Create or update user
analytics.setAccount({
accountId: 'unique-id-123',
firstname: 'juan',
lastname: 'bautista',
email: 'juan.bautista@mail.com',
created: new Date(),
body: {
firstname: 'juan',
lastname: 'bautista',
email: 'juan.bautista@mail.com',
created: new Date(),
}
});
// Create an event.
// Omit `accountId` if event does not need to be associated to user.
analytics.createEvent({

@@ -54,5 +59,11 @@ eventName: 'CREATE_POST',

#### .createAccount(options)
Stores account details to Mixpanel. Only the `accountId` is required. The `firstname`, `lastname`, `email`, and `created` are predefined properties but are not required. If `created` is omitted, it defaults to `new Date()`.
#### .setAccount(options)
Create or update user details to. Only the `accountId` is required.
##### options.accountId
Unique identifier of the user. In Mixpanel, this will appear as Distinct ID.
##### options.body
Details of the user. The `firstname`, `lastname`, `email`, and `created` are predefined properties but are not required. If `created` is omitted, it defaults to `new Date()`.
Any additional custom properties can be added. Values with types of `Buffer` or `ObjectID` are serialized into string using [bs58](https://www.npmjs.com/package/bs58).

@@ -72,6 +83,6 @@

##### options.accountId
##### options.accountId?
Type: `string`
Account associated to the event. Every event in Mixpanel is associated to a specific account.
User associated to the event. If omitted, the event created will not be associated to any user.

@@ -78,0 +89,0 @@ ##### options.body

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc