Feature/segment extended (#1174)

*  Add custom traits

*  Improvements

*  Small changes

*  Improvements
This commit is contained in:
Ricardo Espinoza 2020-11-18 17:37:56 -05:00 committed by GitHub
parent 06fa48dd2e
commit b0863e55b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 75 additions and 1368 deletions

View file

@ -2,6 +2,27 @@
This list shows all the versions which include breaking changes and how to upgrade.
## 0.94.0
### What changed?
In the Segment Node, we have changed how the properties 'traits' and 'properties' are defined. Now, key/value pairs can be provided, allowing you to send customs traits/properties.
### When is action necessary?
When the properties 'traits' or 'properties' are set, and one of the following resources/operations is used:
| Resource | Operation |
|--|--|
| Identify | Create |
| Track | Event |
| Track | Page |
| Group | Add |
### How to upgrade:
Open the affected resource/operation and set the parameters 'traits' or 'properties' again.
## 0.93.0
### What changed?

View file

@ -72,7 +72,7 @@ export const groupFields = [
placeholder: 'Add Trait',
type: 'fixedCollection',
typeOptions: {
multipleValues: false,
multipleValues: true,
},
displayOptions: {
show: {
@ -91,194 +91,18 @@ export const groupFields = [
displayName: 'Trait',
values: [
{
displayName: 'Email',
name: 'email',
displayName: 'Key',
name: 'key',
type: 'string',
default: '',
description: 'Email address of a user',
description: '',
},
{
displayName: 'First Name',
name: 'firstname',
displayName: 'Value',
name: 'value',
type: 'string',
default: '',
description: 'First name of a user',
},
{
displayName: 'Last Name',
name: 'lastname',
type: 'string',
default: '',
description: 'Last name of a user',
},
{
displayName: 'Gender',
name: 'gender',
type: 'string',
default: '',
description: 'Gender of a user',
},
{
displayName: 'Phone',
name: 'phone',
type: 'string',
default: '',
description: 'Phone number of a user',
},
{
displayName: 'Username',
name: 'username',
type: 'string',
default: '',
description: 'Users username',
},
{
displayName: 'Website',
name: 'website',
type: 'string',
default: '',
description: 'Website of a user',
},
{
displayName: 'Age',
name: 'age',
type: 'number',
default: 1,
description: 'Age of a user',
},
{
displayName: 'Avatar',
name: 'avatar',
type: 'string',
default: '',
description: 'URL to an avatar image for the user',
},
{
displayName: 'Birthday',
name: 'birthday',
type: 'dateTime',
default: '',
description: 'Users birthday',
},
{
displayName: 'Created At',
name: 'createdAt',
type: 'dateTime',
default: '',
description: 'Date the users account was first created',
},
{
displayName: 'Description',
name: 'description',
type: 'string',
typeOptions: {
alwaysOpenEditWindow: true,
},
default: '',
description: 'Description of the user',
},
{
displayName: 'ID',
name: 'id',
type: 'string',
default: '',
description: 'Unique ID in your database for a user',
},
{
displayName: 'Company',
name: 'company',
placeholder: 'Add Company',
type: 'fixedCollection',
typeOptions: {
multipleValues: false,
},
default: {},
options: [
{
name: 'companyUi',
displayName: 'Company',
values: [
{
displayName: 'ID',
name: 'id',
type: 'string',
default: '',
},
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
},
{
displayName: 'Industry',
name: 'industry',
type: 'string',
default: '',
},
{
displayName: 'Employee Count',
name: 'employeeCount',
type: 'number',
default: 1,
},
{
displayName: 'Plan',
name: 'plan',
type: 'string',
default: '',
},
],
},
],
},
{
displayName: 'Address',
name: 'address',
placeholder: 'Add Address',
type: 'fixedCollection',
typeOptions: {
multipleValues: false,
},
default: {},
options: [
{
name: 'addressUi',
displayName: 'Address',
values: [
{
displayName: 'Street',
name: 'street',
type: 'string',
default: '',
},
{
displayName: 'City',
name: 'city',
type: 'string',
default: '',
},
{
displayName: 'State',
name: 'state',
type: 'string',
default: '',
},
{
displayName: 'Postal Code',
name: 'postalCode',
type: 'string',
default: '',
},
{
displayName: 'Country',
name: 'country',
type: 'string',
default: '',
},
],
},
],
description: '',
},
],
},

View file

@ -54,7 +54,7 @@ export const identifyFields = [
placeholder: 'Add Trait',
type: 'fixedCollection',
typeOptions: {
multipleValues: false,
multipleValues: true,
},
displayOptions: {
show: {
@ -73,226 +73,18 @@ export const identifyFields = [
displayName: 'Trait',
values: [
{
displayName: 'Email',
name: 'email',
displayName: 'Key',
name: 'key',
type: 'string',
default: '',
description: 'Email address of a user',
description: '',
},
{
displayName: 'First Name',
name: 'firstname',
displayName: 'Value',
name: 'value',
type: 'string',
default: '',
description: 'First name of a user',
},
{
displayName: 'Last Name',
name: 'lastname',
type: 'string',
default: '',
description: 'Last name of a user',
},
{
displayName: 'Gender',
name: 'gender',
type: 'string',
default: '',
description: 'Gender of a user',
},
{
displayName: 'Phone',
name: 'phone',
type: 'string',
default: '',
description: 'Phone number of a user',
},
{
displayName: 'Username',
name: 'username',
type: 'string',
default: '',
description: 'Users username',
},
{
displayName: 'Website',
name: 'website',
type: 'string',
default: '',
description: 'Website of a user',
},
{
displayName: 'Age',
name: 'age',
type: 'number',
default: 1,
description: 'Age of a user',
},
{
displayName: 'Avatar',
name: 'avatar',
type: 'string',
default: '',
description: 'URL to an avatar image for the user',
},
{
displayName: 'Birthday',
name: 'birthday',
type: 'dateTime',
default: '',
description: 'Users birthday',
},
{
displayName: 'Created At',
name: 'createdAt',
type: 'dateTime',
default: '',
description: 'Date the users account was first created',
},
{
displayName: 'Description',
name: 'description',
type: 'string',
typeOptions: {
alwaysOpenEditWindow: true,
},
default: '',
description: 'Description of the user',
},
{
displayName: 'ID',
name: 'id',
type: 'string',
default: '',
description: 'Unique ID in your database for a user',
},
{
displayName: 'Company',
name: 'company',
placeholder: 'Add Company',
type: 'fixedCollection',
typeOptions: {
multipleValues: false,
},
default: {},
options: [
{
name: 'companyUi',
displayName: 'Company',
values: [
{
displayName: 'ID',
name: 'id',
type: 'string',
default: '',
},
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
},
{
displayName: 'Industry',
name: 'industry',
type: 'string',
default: '',
},
{
displayName: 'Employee Count',
name: 'employeeCount',
type: 'number',
default: 1,
},
{
displayName: 'Plan',
name: 'plan',
type: 'string',
default: '',
},
],
},
],
},
{
displayName: 'Address',
name: 'address',
placeholder: 'Add Address',
type: 'fixedCollection',
typeOptions: {
multipleValues: false,
},
default: {},
options: [
{
name: 'addressUi',
displayName: 'Address',
values: [
{
displayName: 'Street',
name: 'street',
type: 'string',
default: '',
},
{
displayName: 'City',
name: 'city',
type: 'string',
default: '',
},
{
displayName: 'State',
name: 'state',
type: 'string',
default: '',
},
{
displayName: 'Postal Code',
name: 'postalCode',
type: 'string',
default: '',
},
{
displayName: 'Country',
name: 'country',
type: 'string',
default: '',
},
],
},
],
},
{
displayName: 'Custom Traits',
name: 'customTraitsUi',
placeholder: 'Add Custom Trait',
type: 'fixedCollection',
default: '',
typeOptions: {
multipleValues: true,
},
options: [
{
name: 'customTraitValues',
displayName: 'Custom Traits',
values: [
{
displayName: 'Key',
name: 'key',
type: 'string',
default: '',
description: '',
},
{
displayName: 'Value',
name: 'value',
type: 'string',
default: '',
description: '',
},
],
},
],
description: '',
},
],
},

View file

@ -38,7 +38,6 @@ import {
} from './TrackInterface';
import * as uuid from 'uuid/v4';
import { customerFields } from '../CustomerIo/CustomerDescription';
export class Segment implements INodeType {
description: INodeTypeDescription = {
@ -110,7 +109,7 @@ export class Segment implements INodeType {
if (operation === 'add') {
const userId = this.getNodeParameter('userId', i) as string;
const groupId = this.getNodeParameter('groupId', i) as string;
const traits = (this.getNodeParameter('traits', i) as IDataObject).traitsUi as IDataObject;
const traits = (this.getNodeParameter('traits', i) as IDataObject).traitsUi as IDataObject[];
const context = (this.getNodeParameter('context', i) as IDataObject).contextUi as IDataObject;
const integrations = (this.getNodeParameter('integrations', i) as IDataObject).integrationsUi as IDataObject;
const body: IGroup = {
@ -132,94 +131,9 @@ export class Segment implements INodeType {
body.anonymousId = uuid();
}
if (traits) {
if (traits.email) {
body.traits!.email = traits.email as string;
}
if (traits.firstname) {
body.traits!.firstname = traits.firstname as string;
}
if (traits.lastname) {
body.traits!.lastname = traits.lastname as string;
}
if (traits.gender) {
body.traits!.gender = traits.gender as string;
}
if (traits.phone) {
body.traits!.phone = traits.phone as string;
}
if (traits.username) {
body.traits!.username = traits.username as string;
}
if (traits.website) {
body.traits!.website = traits.website as string;
}
if (traits.age) {
body.traits!.age = traits.age as number;
}
if (traits.avatar) {
body.traits!.avatar = traits.avatar as string;
}
if (traits.birthday) {
body.traits!.birthday = traits.birthday as string;
}
if (traits.createdAt) {
body.traits!.createdAt = traits.createdAt as string;
}
if (traits.description) {
body.traits!.description = traits.description as string;
}
if (traits.id) {
body.traits!.id = traits.id as string;
}
if (traits.company) {
const company = (traits.company as IDataObject).companyUi as IDataObject;
if (company) {
if (company.id) {
//@ts-ignore
body.traits.company.id = company.id as string;
}
if (company.name) {
//@ts-ignore
body.traits.company.name = company.name as string;
}
if (company.industry) {
//@ts-ignore
body.traits.company.industry = company.industry as string;
}
if (company.employeeCount) {
//@ts-ignore
body.traits.company.employeeCount = company.employeeCount as number;
}
if (company.plan) {
//@ts-ignore
body.traits.company.plan = company.plan as string;
}
}
}
if (traits.address) {
const address = (traits.address as IDataObject).addressUi as IDataObject;
if (address) {
if (address.street) {
//@ts-ignore
body.traits.address.street = address.street as string;
}
if (address.city) {
//@ts-ignore
body.traits.address.city = address.city as string;
}
if (address.state) {
//@ts-ignore
body.traits.address.state = address.state as string;
}
if (address.postalCode) {
//@ts-ignore
body.traits.address.postalCode = address.postalCode as string;
}
if (address.country) {
//@ts-ignore
body.traits.address.country = address.country as string;
}
if (traits && traits.length !== 0) {
for (const trait of traits) {
body.traits![trait.key as string] = trait.value;
}
}
}
@ -326,19 +240,16 @@ export class Segment implements INodeType {
//https://segment.com/docs/connections/sources/catalog/libraries/server/http-api/#identify
if (operation === 'create') {
const userId = this.getNodeParameter('userId', i) as string;
const traits = (this.getNodeParameter('traits', i) as IDataObject).traitsUi as IDataObject;
const context = (this.getNodeParameter('context', i) as IDataObject).contextUi as IDataObject;
const traits = (this.getNodeParameter('traits', i) as IDataObject).traitsUi as IDataObject[];
const integrations = (this.getNodeParameter('integrations', i) as IDataObject).integrationsUi as IDataObject;
const body: IIdentify = {
traits: {
company: {},
address: {},
},
context: {
app: {},
campaign: {},
device: {},
},
traits: {},
integrations: {},
};
if (userId) {
@ -346,105 +257,6 @@ export class Segment implements INodeType {
} else {
body.anonymousId = uuid();
}
if (traits) {
if (traits.email) {
body.traits!.email = traits.email as string;
}
if (traits.firstname) {
body.traits!.firstname = traits.firstname as string;
}
if (traits.lastname) {
body.traits!.lastname = traits.lastname as string;
}
if (traits.gender) {
body.traits!.gender = traits.gender as string;
}
if (traits.phone) {
body.traits!.phone = traits.phone as string;
}
if (traits.username) {
body.traits!.username = traits.username as string;
}
if (traits.website) {
body.traits!.website = traits.website as string;
}
if (traits.age) {
body.traits!.age = traits.age as number;
}
if (traits.avatar) {
body.traits!.avatar = traits.avatar as string;
}
if (traits.birthday) {
body.traits!.birthday = traits.birthday as string;
}
if (traits.createdAt) {
body.traits!.createdAt = traits.createdAt as string;
}
if (traits.description) {
body.traits!.description = traits.description as string;
}
if (traits.id) {
body.traits!.id = traits.id as string;
}
if (traits.customTraitsUi) {
const customTraits = (traits.customTraitsUi as IDataObject).customTraitValues as IDataObject[];
if (customTraits && customTraits.length !== 0) {
for (const customTrait of customTraits) {
body.traits![customTrait.key as string] = customTrait.value;
}
}
}
if (traits.company) {
const company = (traits.company as IDataObject).companyUi as IDataObject;
if (company) {
if (company.id) {
//@ts-ignore
body.traits.company.id = company.id as string;
}
if (company.name) {
//@ts-ignore
body.traits.company.name = company.name as string;
}
if (company.industry) {
//@ts-ignore
body.traits.company.industry = company.industry as string;
}
if (company.employeeCount) {
//@ts-ignore
body.traits.company.employeeCount = company.employeeCount as number;
}
if (company.plan) {
//@ts-ignore
body.traits.company.plan = company.plan as string;
}
}
}
if (traits.address) {
const address = (traits.address as IDataObject).addressUi as IDataObject;
if (address) {
if (address.street) {
//@ts-ignore
body.traits.address.street = address.street as string;
}
if (address.city) {
//@ts-ignore
body.traits.address.city = address.city as string;
}
if (address.state) {
//@ts-ignore
body.traits.address.state = address.state as string;
}
if (address.postalCode) {
//@ts-ignore
body.traits.address.postalCode = address.postalCode as string;
}
if (address.country) {
//@ts-ignore
body.traits.address.country = address.country as string;
}
}
}
}
if (context) {
if (context.active) {
body.context!.active = context.active as boolean;
@ -542,14 +354,12 @@ export class Segment implements INodeType {
}
}
if (Object.keys(traits.company as IDataObject).length === 0) {
//@ts-ignore
delete body.traits.company;
}
if (Object.keys(traits.address as IDataObject).length === 0) {
//@ts-ignore
delete body.traits.address;
if (traits) {
if (traits && traits.length !== 0) {
for (const trait of traits) {
body.traits![trait.key as string] = trait.value;
}
}
}
responseData = await segmentApiRequest.call(this, 'POST', '/identify', body);
@ -560,15 +370,12 @@ export class Segment implements INodeType {
if (operation === 'event') {
const userId = this.getNodeParameter('userId', i) as string;
const event = this.getNodeParameter('event', i) as string;
const traits = (this.getNodeParameter('traits', i) as IDataObject).traitsUi as IDataObject;
const context = (this.getNodeParameter('context', i) as IDataObject).contextUi as IDataObject;
const integrations = (this.getNodeParameter('integrations', i) as IDataObject).integrationsUi as IDataObject;
const properties = (this.getNodeParameter('properties', i) as IDataObject).propertiesUi as IDataObject;
const properties = (this.getNodeParameter('properties', i) as IDataObject).propertiesUi as IDataObject[];
const body: ITrack = {
event,
traits: {
company: {},
address: {},
},
context: {
app: {},
@ -583,105 +390,6 @@ export class Segment implements INodeType {
} else {
body.anonymousId = uuid();
}
if (traits) {
if (traits.email) {
body.traits!.email = traits.email as string;
}
if (traits.firstname) {
body.traits!.firstname = traits.firstname as string;
}
if (traits.lastname) {
body.traits!.lastname = traits.lastname as string;
}
if (traits.gender) {
body.traits!.gender = traits.gender as string;
}
if (traits.phone) {
body.traits!.phone = traits.phone as string;
}
if (traits.username) {
body.traits!.username = traits.username as string;
}
if (traits.website) {
body.traits!.website = traits.website as string;
}
if (traits.age) {
body.traits!.age = traits.age as number;
}
if (traits.avatar) {
body.traits!.avatar = traits.avatar as string;
}
if (traits.birthday) {
body.traits!.birthday = traits.birthday as string;
}
if (traits.createdAt) {
body.traits!.createdAt = traits.createdAt as string;
}
if (traits.description) {
body.traits!.description = traits.description as string;
}
if (traits.id) {
body.traits!.id = traits.id as string;
}
if (traits.customTraitsUi) {
const customTraits = (traits.customTraitsUi as IDataObject).customTraitValues as IDataObject[];
if (customTraits && customTraits.length !== 0) {
for (const customTrait of customTraits) {
body.traits![customTrait.key as string] = customTrait.value;
}
}
}
if (traits.company) {
const company = (traits.company as IDataObject).companyUi as IDataObject;
if (company) {
if (company.id) {
//@ts-ignore
body.traits.company.id = company.id as string;
}
if (company.name) {
//@ts-ignore
body.traits.company.name = company.name as string;
}
if (company.industry) {
//@ts-ignore
body.traits.company.industry = company.industry as string;
}
if (company.employeeCount) {
//@ts-ignore
body.traits.company.employeeCount = company.employeeCount as number;
}
if (company.plan) {
//@ts-ignore
body.traits.company.plan = company.plan as string;
}
}
}
if (traits.address) {
const address = (traits.address as IDataObject).addressUi as IDataObject;
if (address) {
if (address.street) {
//@ts-ignore
body.traits.address.street = address.street as string;
}
if (address.city) {
//@ts-ignore
body.traits.address.city = address.city as string;
}
if (address.state) {
//@ts-ignore
body.traits.address.state = address.state as string;
}
if (address.postalCode) {
//@ts-ignore
body.traits.address.postalCode = address.postalCode as string;
}
if (address.country) {
//@ts-ignore
body.traits.address.country = address.country as string;
}
}
}
}
if (context) {
if (context.active) {
body.context!.active = context.active as boolean;
@ -779,25 +487,11 @@ export class Segment implements INodeType {
}
}
if (properties) {
if (properties.revenue) {
body.properties!.revenue = properties.revenue as number;
if (properties && properties.length !== 0) {
for (const property of properties) {
body.properties![property.key as string] = property.value;
}
}
if (properties.currency) {
body.properties!.currency = properties.currency as string;
}
if (properties.value) {
body.properties!.value = properties.value as string;
}
}
if (Object.keys(traits.company as IDataObject).length === 0) {
//@ts-ignore
delete body.traits.company;
}
if (Object.keys(traits.address as IDataObject).length === 0) {
//@ts-ignore
delete body.traits.address;
}
responseData = await segmentApiRequest.call(this, 'POST', '/track', body);
@ -805,17 +499,13 @@ export class Segment implements INodeType {
//https://segment.com/docs/connections/sources/catalog/libraries/server/http-api/#page
if (operation === 'page') {
const userId = this.getNodeParameter('userId', i) as string;
const event = this.getNodeParameter('event', i) as string;
const traits = (this.getNodeParameter('traits', i) as IDataObject).traitsUi as IDataObject;
const name = this.getNodeParameter('name', i) as string;
const context = (this.getNodeParameter('context', i) as IDataObject).contextUi as IDataObject;
const integrations = (this.getNodeParameter('integrations', i) as IDataObject).integrationsUi as IDataObject;
const properties = (this.getNodeParameter('properties', i) as IDataObject).propertiesUi as IDataObject;
const properties = (this.getNodeParameter('properties', i) as IDataObject).propertiesUi as IDataObject[];
const body: ITrack = {
event,
traits: {
company: {},
address: {},
},
name,
traits: {},
context: {
app: {},
campaign: {},
@ -829,97 +519,6 @@ export class Segment implements INodeType {
} else {
body.anonymousId = uuid();
}
if (traits) {
if (traits.email) {
body.traits!.email = traits.email as string;
}
if (traits.firstname) {
body.traits!.firstname = traits.firstname as string;
}
if (traits.lastname) {
body.traits!.lastname = traits.lastname as string;
}
if (traits.gender) {
body.traits!.gender = traits.gender as string;
}
if (traits.phone) {
body.traits!.phone = traits.phone as string;
}
if (traits.username) {
body.traits!.username = traits.username as string;
}
if (traits.website) {
body.traits!.website = traits.website as string;
}
if (traits.age) {
body.traits!.age = traits.age as number;
}
if (traits.avatar) {
body.traits!.avatar = traits.avatar as string;
}
if (traits.birthday) {
body.traits!.birthday = traits.birthday as string;
}
if (traits.createdAt) {
body.traits!.createdAt = traits.createdAt as string;
}
if (traits.description) {
body.traits!.description = traits.description as string;
}
if (traits.id) {
body.traits!.id = traits.id as string;
}
if (traits.company) {
const company = (traits.company as IDataObject).companyUi as IDataObject;
if (company) {
if (company.id) {
//@ts-ignore
body.traits.company.id = company.id as string;
}
if (company.name) {
//@ts-ignore
body.traits.company.name = company.name as string;
}
if (company.industry) {
//@ts-ignore
body.traits.company.industry = company.industry as string;
}
if (company.employeeCount) {
//@ts-ignore
body.traits.company.employeeCount = company.employeeCount as number;
}
if (company.plan) {
//@ts-ignore
body.traits.company.plan = company.plan as string;
}
}
}
if (traits.address) {
const address = (traits.address as IDataObject).addressUi as IDataObject;
if (address) {
if (address.street) {
//@ts-ignore
body.traits.address.street = address.street as string;
}
if (address.city) {
//@ts-ignore
body.traits.address.city = address.city as string;
}
if (address.state) {
//@ts-ignore
body.traits.address.state = address.state as string;
}
if (address.postalCode) {
//@ts-ignore
body.traits.address.postalCode = address.postalCode as string;
}
if (address.country) {
//@ts-ignore
body.traits.address.country = address.country as string;
}
}
}
}
if (context) {
if (context.active) {
body.context!.active = context.active as boolean;
@ -1017,26 +616,10 @@ export class Segment implements INodeType {
}
}
if (properties) {
if (properties.name) {
body.properties!.name = properties.name as number;
}
if (properties.path) {
body.properties!.path = properties.path as string;
}
if (properties.referrer) {
body.properties!.referrer = properties.referrer as string;
}
if (properties.search) {
body.properties!.search = properties.search as string;
}
if (properties.title) {
body.properties!.title = properties.title as string;
}
if (properties.url) {
body.properties!.url = properties.url as string;
}
if (properties.keywords) {
body.properties!.keywords = properties.keywords as string;
if (properties && properties.length !== 0) {
for (const property of properties) {
body.properties![property.key as string] = property.value;
}
}
}
responseData = await segmentApiRequest.call(this, 'POST', '/page', body);

View file

@ -71,256 +71,6 @@ export const trackFields = [
description: 'Name of the action that a user has performed.',
required: true,
},
{
displayName: 'Traits',
name: 'traits',
placeholder: 'Add Trait',
type: 'fixedCollection',
typeOptions: {
multipleValues: false,
},
displayOptions: {
show: {
resource: [
'track',
],
operation: [
'event',
],
},
},
default: {},
options: [
{
name: 'traitsUi',
displayName: 'Trait',
values: [
{
displayName: 'Email',
name: 'email',
type: 'string',
default: '',
description: 'Email address of a user',
},
{
displayName: 'First Name',
name: 'firstname',
type: 'string',
default: '',
description: 'First name of a user',
},
{
displayName: 'Last Name',
name: 'lastname',
type: 'string',
default: '',
description: 'Last name of a user',
},
{
displayName: 'Gender',
name: 'gender',
type: 'string',
default: '',
description: 'Gender of a user',
},
{
displayName: 'Phone',
name: 'phone',
type: 'string',
default: '',
description: 'Phone number of a user',
},
{
displayName: 'Username',
name: 'username',
type: 'string',
default: '',
description: 'Users username',
},
{
displayName: 'Website',
name: 'website',
type: 'string',
default: '',
description: 'Website of a user',
},
{
displayName: 'Age',
name: 'age',
type: 'number',
default: 1,
description: 'Age of a user',
},
{
displayName: 'Avatar',
name: 'avatar',
type: 'string',
default: '',
description: 'URL to an avatar image for the user',
},
{
displayName: 'Birthday',
name: 'birthday',
type: 'dateTime',
default: '',
description: 'Users birthday',
},
{
displayName: 'Created At',
name: 'createdAt',
type: 'dateTime',
default: '',
description: 'Date the users account was first created at',
},
{
displayName: 'Description',
name: 'description',
type: 'string',
typeOptions: {
alwaysOpenEditWindow: true,
},
default: '',
description: 'Description of the user',
},
{
displayName: 'ID',
name: 'id',
type: 'string',
default: '',
description: 'Unique ID in your database for a user',
},
{
displayName: 'Company',
name: 'company',
placeholder: 'Add Company',
type: 'fixedCollection',
typeOptions: {
multipleValues: false,
},
default: {},
options: [
{
name: 'companyUi',
displayName: 'Company',
values: [
{
displayName: 'ID',
name: 'id',
type: 'string',
default: '',
},
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
},
{
displayName: 'Industry',
name: 'industry',
type: 'string',
default: '',
},
{
displayName: 'Employee Count',
name: 'employeeCount',
type: 'number',
default: 1,
},
{
displayName: 'Plan',
name: 'plan',
type: 'string',
default: '',
},
],
},
],
},
{
displayName: 'Address',
name: 'address',
placeholder: 'Add Address',
type: 'fixedCollection',
typeOptions: {
multipleValues: false,
},
default: {},
options: [
{
name: 'addressUi',
displayName: 'Address',
values: [
{
displayName: 'Street',
name: 'street',
type: 'string',
default: '',
},
{
displayName: 'City',
name: 'city',
type: 'string',
default: '',
},
{
displayName: 'State',
name: 'state',
type: 'string',
default: '',
},
{
displayName: 'Postal Code',
name: 'postalCode',
type: 'string',
default: '',
},
{
displayName: 'Country',
name: 'country',
type: 'string',
default: '',
},
],
},
],
},
{
displayName: 'Custom Traits',
name: 'customTraitsUi',
placeholder: 'Add Custom Trait',
type: 'fixedCollection',
default: '',
typeOptions: {
multipleValues: true,
},
options: [
{
name: 'customTraitValues',
displayName: 'Custom Traits',
values: [
{
displayName: 'Key',
name: 'key',
type: 'string',
default: '',
description: '',
},
{
displayName: 'Value',
name: 'value',
type: 'string',
default: '',
description: '',
},
],
},
],
},
],
},
],
},
{
displayName: 'Context',
name: 'context',
@ -568,7 +318,7 @@ export const trackFields = [
placeholder: 'Add Properties',
type: 'fixedCollection',
typeOptions: {
multipleValues: false,
multipleValues: true,
},
displayOptions: {
show: {
@ -584,31 +334,21 @@ export const trackFields = [
options: [
{
name: 'propertiesUi',
displayName: 'Properties',
displayName: 'Property',
values: [
{
displayName: 'Revenue',
name: 'revenue',
type: 'number',
typeOptions: {
numberPrecision: 2,
},
default: 1,
description: 'Amount of revenue an event resulted in. This should be a decimal value, so a shirt worth $19.99 would result in a revenue of 19.99.',
},
{
displayName: 'Currency',
name: 'currency',
displayName: 'Key',
name: 'key',
type: 'string',
default: '',
description: 'Currency of the revenue an event resulted in <p>This should be sent in the ISO 4127 format. If this is not set, we assume the revenue to be in US dollars.</p>',
description: '',
},
{
displayName: 'Value',
name: 'value',
type: 'number',
type: 'string',
default: '',
description: 'An abstract “value” to associate with an event. This is typically used in situations where the event doesnt generate real-dollar revenue, but has an intrinsic value to a marketing team, like newsletter signups.',
description: '',
},
],
},
@ -650,224 +390,6 @@ export const trackFields = [
},
description: 'Name of the page For example, most sites have a “Signup” page that can be useful to tag, so you can see users as they move through your funnel',
},
{
displayName: 'Traits',
name: 'traits',
placeholder: 'Add Trait',
type: 'fixedCollection',
typeOptions: {
multipleValues: false,
},
displayOptions: {
show: {
resource: [
'track',
],
operation: [
'page',
],
},
},
default: {},
options: [
{
name: 'traitsUi',
displayName: 'Trait',
values: [
{
displayName: 'Email',
name: 'email',
type: 'string',
default: '',
description: 'Email address of a user',
},
{
displayName: 'First Name',
name: 'firstname',
type: 'string',
default: '',
description: 'First name of a user',
},
{
displayName: 'Last Name',
name: 'lastname',
type: 'string',
default: '',
description: 'Last name of a user',
},
{
displayName: 'Gender',
name: 'gender',
type: 'string',
default: '',
description: 'Gender of a user',
},
{
displayName: 'Phone',
name: 'phone',
type: 'string',
default: '',
description: 'Phone number of a user',
},
{
displayName: 'Username',
name: 'username',
type: 'string',
default: '',
description: 'Users username',
},
{
displayName: 'Website',
name: 'website',
type: 'string',
default: '',
description: 'Website of a user',
},
{
displayName: 'Age',
name: 'age',
type: 'number',
default: 1,
description: 'Age of a user',
},
{
displayName: 'Avatar',
name: 'avatar',
type: 'string',
default: '',
description: 'URL to an avatar image for the user',
},
{
displayName: 'Birthday',
name: 'birthday',
type: 'dateTime',
default: '',
description: 'Users birthday',
},
{
displayName: 'Created At',
name: 'createdAt',
type: 'dateTime',
default: '',
description: 'Date the users account was first created at',
},
{
displayName: 'Description',
name: 'description',
type: 'string',
typeOptions: {
alwaysOpenEditWindow: true,
},
default: '',
description: 'Description of the user',
},
{
displayName: 'ID',
name: 'id',
type: 'string',
default: '',
description: 'Unique ID in your database for a user',
},
{
displayName: 'Company',
name: 'company',
placeholder: 'Add Company',
type: 'fixedCollection',
typeOptions: {
multipleValues: false,
},
default: {},
options: [
{
name: 'companyUi',
displayName: 'Company',
values: [
{
displayName: 'ID',
name: 'id',
type: 'string',
default: '',
},
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
},
{
displayName: 'Industry',
name: 'industry',
type: 'string',
default: '',
},
{
displayName: 'Employee Count',
name: 'employeeCount',
type: 'number',
default: 1,
},
{
displayName: 'Plan',
name: 'plan',
type: 'string',
default: '',
},
],
},
],
},
{
displayName: 'Address',
name: 'address',
placeholder: 'Add Address',
type: 'fixedCollection',
typeOptions: {
multipleValues: false,
},
default: {},
options: [
{
name: 'addressUi',
displayName: 'Address',
values: [
{
displayName: 'Street',
name: 'street',
type: 'string',
default: '',
},
{
displayName: 'City',
name: 'city',
type: 'string',
default: '',
},
{
displayName: 'State',
name: 'state',
type: 'string',
default: '',
},
{
displayName: 'Postal Code',
name: 'postalCode',
type: 'string',
default: '',
},
{
displayName: 'Country',
name: 'country',
type: 'string',
default: '',
},
],
},
],
},
],
},
],
},
{
displayName: 'Context',
name: 'context',
@ -1115,7 +637,7 @@ export const trackFields = [
placeholder: 'Add Properties',
type: 'fixedCollection',
typeOptions: {
multipleValues: false,
multipleValues: true,
},
displayOptions: {
show: {
@ -1131,56 +653,21 @@ export const trackFields = [
options: [
{
name: 'propertiesUi',
displayName: 'Properties',
displayName: 'Property',
values: [
{
displayName: 'Name',
name: 'name',
displayName: 'Key',
name: 'key',
type: 'string',
default: '',
description: 'Name of the page. This is reserved for future use.',
description: '',
},
{
displayName: 'Path',
name: 'path',
displayName: 'Value',
name: 'value',
type: 'string',
default: '',
description: 'Path portion of the URL of the page. Equivalent to canonical path which defaults to location.pathname from the DOM API.',
},
{
displayName: 'Referrer',
name: 'referrer',
type: 'string',
default: '',
description: 'Full URL of the previous page. Equivalent to document.referrer from the DOM API.',
},
{
displayName: 'Search',
name: 'search',
type: 'string',
default: '',
description: 'Query string portion of the URL of the page. Equivalent to location.search from the DOM API.',
},
{
displayName: 'Title',
name: 'title',
type: 'string',
default: '',
description: 'Title of the page. Equivalent to document.title from the DOM API.',
},
{
displayName: 'URL',
name: 'url',
type: 'string',
default: '',
description: 'Full URL of the page. First we look for the canonical url. If the canonical url is not provided, we use location.href from the DOM API.',
},
{
displayName: 'Keywords',
name: 'keywords',
type: 'string',
default: '',
description: 'A list/array of keywords describing the content of the page. The keywords would most likely be the same as, or similar to, the keywords you would find in an html meta tag for SEO purposes.',
description: '',
},
],
},