Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SD-98474 | [Madeira Madeira] Custom Identifier Improvement #1911

Merged
merged 8 commits into from
Mar 12, 2024
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Object {
"identifiers": Object {
"custom": Object {
"segment_anonymous_id": "0xlI!lem[5]2MJvda",
"testType": "0xlI!lem[5]2MJvda",
},
"uuid": "0xlI!lem[5]2MJvda",
},
Expand Down Expand Up @@ -79,6 +80,7 @@ Object {
"identifiers": Object {
"custom": Object {
"segment_anonymous_id": "0xlI!lem[5]2MJvda",
"testType": "0xlI!lem[5]2MJvda",
},
"uuid": "0xlI!lem[5]2MJvda",
},
Expand Down Expand Up @@ -138,6 +140,7 @@ Object {
"identifiers": Object {
"custom": Object {
"segment_anonymous_id": "i2DYKi53!byOli1^))*",
"testType": "i2DYKi53!byOli1^))*",
},
"uuid": "i2DYKi53!byOli1^))*",
},
Expand Down Expand Up @@ -167,6 +170,7 @@ Object {
"identifiers": Object {
"custom": Object {
"segment_anonymous_id": "i2DYKi53!byOli1^))*",
"testType": "i2DYKi53!byOli1^))*",
},
"uuid": "i2DYKi53!byOli1^))*",
},
Expand Down Expand Up @@ -226,6 +230,7 @@ Object {
"identifiers": Object {
"custom": Object {
"segment_anonymous_id": "%detmPE)QcMI3#y0Y",
"testType": "%detmPE)QcMI3#y0Y",
},
"uuid": "%detmPE)QcMI3#y0Y",
},
Expand Down Expand Up @@ -255,6 +260,7 @@ Object {
"identifiers": Object {
"custom": Object {
"segment_anonymous_id": "%detmPE)QcMI3#y0Y",
"testType": "%detmPE)QcMI3#y0Y",
},
"uuid": "%detmPE)QcMI3#y0Y",
},
Expand Down Expand Up @@ -314,6 +320,7 @@ Object {
"identifiers": Object {
"custom": Object {
"segment_anonymous_id": "pVmlekeqp9EloEHBS",
"testType": "pVmlekeqp9EloEHBS",
},
"uuid": "pVmlekeqp9EloEHBS",
},
Expand Down Expand Up @@ -343,6 +350,7 @@ Object {
"identifiers": Object {
"custom": Object {
"segment_anonymous_id": "pVmlekeqp9EloEHBS",
"testType": "pVmlekeqp9EloEHBS",
},
"uuid": "pVmlekeqp9EloEHBS",
},
Expand Down Expand Up @@ -395,6 +403,7 @@ Object {
"identifiers": Object {
"custom": Object {
"segment_anonymous_id": "SFVk3AFZB*U7Pg",
"testType": "SFVk3AFZB*U7Pg",
},
"uuid": "SFVk3AFZB*U7Pg",
},
Expand Down Expand Up @@ -424,6 +433,7 @@ Object {
"identifiers": Object {
"custom": Object {
"segment_anonymous_id": "SFVk3AFZB*U7Pg",
"testType": "SFVk3AFZB*U7Pg",
},
"uuid": "SFVk3AFZB*U7Pg",
},
Expand Down Expand Up @@ -483,6 +493,7 @@ Object {
"identifiers": Object {
"custom": Object {
"segment_anonymous_id": "!Ivq)L",
"testType": "!Ivq)L",
},
"email": "hafogro@nonak.bm",
"phone_number": "!Ivq)L",
Expand Down Expand Up @@ -514,6 +525,7 @@ Object {
"identifiers": Object {
"custom": Object {
"segment_anonymous_id": "!Ivq)L",
"testType": "!Ivq)L",
},
"uuid": "!Ivq)L",
},
Expand Down Expand Up @@ -573,6 +585,7 @@ Object {
"identifiers": Object {
"custom": Object {
"segment_anonymous_id": "jjiPS4iz",
"testType": "jjiPS4iz",
},
"email": "dicnuzo@dik.ae",
"phone_number": "jjiPS4iz",
Expand Down Expand Up @@ -604,6 +617,7 @@ Object {
"identifiers": Object {
"custom": Object {
"segment_anonymous_id": "jjiPS4iz",
"testType": "jjiPS4iz",
},
"uuid": "jjiPS4iz",
},
Expand Down Expand Up @@ -666,6 +680,7 @@ Object {
"identifiers": Object {
"custom": Object {
"segment_anonymous_id": "74Eoa(TEWXz$1Kje",
"testType": "74Eoa(TEWXz$1Kje",
},
"uuid": "74Eoa(TEWXz$1Kje",
},
Expand Down Expand Up @@ -695,6 +710,7 @@ Object {
"identifiers": Object {
"custom": Object {
"segment_anonymous_id": "74Eoa(TEWXz$1Kje",
"testType": "74Eoa(TEWXz$1Kje",
},
"uuid": "74Eoa(TEWXz$1Kje",
},
Expand Down Expand Up @@ -731,6 +747,7 @@ Object {
"identifiers": Object {
"custom": Object {
"segment_anonymous_id": "CA9^h[(o",
"testType": "CA9^h[(o",
},
"email": "tofzammi@paremu.ru",
"phone_number": "CA9^h[(o",
Expand All @@ -751,6 +768,7 @@ Object {
"identifiers": Object {
"custom": Object {
"segment_anonymous_id": "CA9^h[(o",
"testType": "CA9^h[(o",
},
"uuid": "CA9^h[(o",
},
Expand Down Expand Up @@ -798,6 +816,7 @@ Object {
"identifiers": Object {
"custom": Object {
"segment_anonymous_id": "xt]Bf",
"testType": "xt]Bf",
},
"email": "gihehena@vidrow.tc",
"phone_number": "xt]Bf",
Expand Down Expand Up @@ -829,6 +848,7 @@ Object {
"identifiers": Object {
"custom": Object {
"segment_anonymous_id": "xt]Bf",
"testType": "xt]Bf",
},
"uuid": "xt]Bf",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Object {
"identifiers": Object {
"custom": Object {
"segment_anonymous_id": "uh[f!Dz)ZqkDd$x",
"testType": "uh[f!Dz)ZqkDd$x",
},
"uuid": "uh[f!Dz)ZqkDd$x",
},
Expand Down Expand Up @@ -79,6 +80,7 @@ Object {
"identifiers": Object {
"custom": Object {
"segment_anonymous_id": "uh[f!Dz)ZqkDd$x",
"testType": "uh[f!Dz)ZqkDd$x",
},
"uuid": "uh[f!Dz)ZqkDd$x",
},
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import {
timestamp,
user_attributes,
uuid,
append_arrays
append_arrays,
custom_identifiers
} from '../insider-properties'
import { API_BASE, sendBulkTrackEvents, sendTrackEvent, UPSERT_ENDPOINT } from '../insider-helpers'

Expand All @@ -24,6 +25,7 @@ const action: ActionDefinition<Settings, Payload> = {
append_arrays: { ...append_arrays },
uuid: { ...uuid },
segment_anonymous_id: { ...segment_anonymous_id },
custom_identifiers: { ...custom_identifiers },
timestamp: { ...timestamp },
parameters: { ...cart_event_parameters },
products: { ...products },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Object {
"identifiers": Object {
"custom": Object {
"segment_anonymous_id": "Q!Q[jv1Wi&s0",
"testType": "Q!Q[jv1Wi&s0",
},
"email": "dobaj@zuzpini.nc",
"phone_number": "Q!Q[jv1Wi&s0",
Expand Down Expand Up @@ -81,6 +82,7 @@ Object {
"identifiers": Object {
"custom": Object {
"segment_anonymous_id": "Q!Q[jv1Wi&s0",
"testType": "Q!Q[jv1Wi&s0",
},
"uuid": "Q!Q[jv1Wi&s0",
},
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import {
timestamp,
user_attributes,
uuid,
append_arrays
append_arrays,
custom_identifiers
} from '../insider-properties'
import { API_BASE, sendBulkTrackEvents, sendTrackEvent, UPSERT_ENDPOINT } from '../insider-helpers'

Expand All @@ -24,6 +25,7 @@ const action: ActionDefinition<Settings, Payload> = {
append_arrays: { ...append_arrays },
uuid: { ...uuid },
segment_anonymous_id: { ...segment_anonymous_id },
custom_identifiers: { ...custom_identifiers },
timestamp: { ...timestamp },
parameters: { ...checkout_event_parameters },
products: { ...products },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ export function userProfilePayload(data: UserPayload) {
}
}

if (data.custom_identifiers) {
identifiers.custom = {
...identifiers.custom,
...data.custom_identifiers
}
}

if (data.email_as_identifier) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
Expand Down Expand Up @@ -137,6 +144,13 @@ export function sendTrackEvent(
}
}

if (data.custom_identifiers) {
identifiers.custom = {
...identifiers.custom,
...data.custom_identifiers
}
}

if (data.email_as_identifier && data?.attributes?.email) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
Expand Down Expand Up @@ -265,7 +279,8 @@ export function bulkUserProfilePayload(data: UserPayload[]) {
const identifiers = {
uuid: userPayload.uuid,
custom: {
segment_anonymous_id: userPayload.segment_anonymous_id
segment_anonymous_id: userPayload.segment_anonymous_id,
...userPayload.custom_identifiers
}
}

Expand Down Expand Up @@ -381,6 +396,13 @@ export function sendBulkTrackEvents(
}
}

if (data.custom_identifiers) {
identifiers.custom = {
...identifiers.custom,
...data.custom_identifiers
}
}

if (data.email_as_identifier && data?.attributes?.email) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,14 @@ export const segment_anonymous_id: InputField = {
default: { '@path': '$.anonymousId' }
}

export const custom_identifiers: InputField = {
label: 'Custom Identifiers',
type: 'object',
description: 'You can select your custom identifiers for the event.',
Copy link
Contributor

@joe-ayoub-segment joe-ayoub-segment Mar 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @emreisik95.

2 questions:

  1. Should we default the UI to display key:value pairs?
    defaultObjectUI: 'keyvalue'

  2. Should we make the description a little more useful? Are there specific types of Custom Identifiers the user should know about? How should the user know what to place in this field? Can you provide an example or link to a doc?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it should be default key:value pairs, we are accepting it as key:value. Also, it should be undefined if partner won't use it.

For the second question, I'll align with our PM's and answer.

default: undefined,
additionalProperties: true
}

export const event_name: InputField = {
label: 'Event Name',
type: 'string',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Object {
"identifiers": Object {
"custom": Object {
"segment_anonymous_id": "^nSY[JM",
"testType": "^nSY[JM",
},
"email": "ciboba@duzehoc.lt",
"phone_number": "^nSY[JM",
Expand Down Expand Up @@ -81,6 +82,7 @@ Object {
"identifiers": Object {
"custom": Object {
"segment_anonymous_id": "^nSY[JM",
"testType": "^nSY[JM",
},
"uuid": "^nSY[JM",
},
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import {
timestamp,
user_attributes,
uuid,
append_arrays
append_arrays,
custom_identifiers
} from '../insider-properties'
import { API_BASE, sendBulkTrackEvents, sendTrackEvent, UPSERT_ENDPOINT } from '../insider-helpers'

Expand All @@ -24,6 +25,7 @@ const action: ActionDefinition<Settings, Payload> = {
append_arrays: { ...append_arrays },
uuid: { ...uuid },
segment_anonymous_id: { ...segment_anonymous_id },
custom_identifiers: { ...custom_identifiers },
timestamp: { ...timestamp },
parameters: { ...order_event_parameters },
products: { ...products },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Object {
"identifiers": Object {
"custom": Object {
"segment_anonymous_id": "G!)xRN2DwZB33yYCIUOK",
"testType": "G!)xRN2DwZB33yYCIUOK",
},
"uuid": "G!)xRN2DwZB33yYCIUOK",
},
Expand Down Expand Up @@ -79,6 +80,7 @@ Object {
"identifiers": Object {
"custom": Object {
"segment_anonymous_id": "G!)xRN2DwZB33yYCIUOK",
"testType": "G!)xRN2DwZB33yYCIUOK",
},
"uuid": "G!)xRN2DwZB33yYCIUOK",
},
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading