From 2f2debbe717f97653b8e26d65f41e121c2bd9511 Mon Sep 17 00:00:00 2001 From: Zihe Jia Date: Mon, 17 Oct 2022 15:46:21 -0700 Subject: [PATCH] mapping mixpanel '$ip' for identify call --- .../mixpanel/identifyUser/__tests__/index.test.ts | 4 ++++ .../mixpanel/identifyUser/generated-types.ts | 4 ++++ .../src/destinations/mixpanel/identifyUser/index.ts | 9 +++++++++ 3 files changed, 17 insertions(+) diff --git a/packages/destination-actions/src/destinations/mixpanel/identifyUser/__tests__/index.test.ts b/packages/destination-actions/src/destinations/mixpanel/identifyUser/__tests__/index.test.ts index 6f64a1638c..f4d22bb3c0 100644 --- a/packages/destination-actions/src/destinations/mixpanel/identifyUser/__tests__/index.test.ts +++ b/packages/destination-actions/src/destinations/mixpanel/identifyUser/__tests__/index.test.ts @@ -57,6 +57,7 @@ describe('Mixpanel.identifyUser', () => { data: JSON.stringify({ $token: MIXPANEL_PROJECT_TOKEN, $distinct_id: 'user1234', + $ip: '8.8.8.8', $set: { abc: '123', $created: '2022-10-12T00:00:00.000Z', @@ -109,6 +110,7 @@ describe('Mixpanel.identifyUser', () => { data: JSON.stringify({ $token: MIXPANEL_PROJECT_TOKEN, $distinct_id: 'user1234', + $ip: '8.8.8.8', $set: { abc: '123' } @@ -153,6 +155,7 @@ describe('Mixpanel.identifyUser', () => { data: JSON.stringify({ $token: MIXPANEL_PROJECT_TOKEN, $distinct_id: 'user1234', + $ip: '8.8.8.8', $set: { abc: '123' } @@ -199,6 +202,7 @@ describe('Mixpanel.identifyUser', () => { data: JSON.stringify({ $token: MIXPANEL_PROJECT_TOKEN, $distinct_id: 'user1234', + $ip: '8.8.8.8', $set: { abc: '123' } diff --git a/packages/destination-actions/src/destinations/mixpanel/identifyUser/generated-types.ts b/packages/destination-actions/src/destinations/mixpanel/identifyUser/generated-types.ts index d841ddbdc4..7728a42e3a 100644 --- a/packages/destination-actions/src/destinations/mixpanel/identifyUser/generated-types.ts +++ b/packages/destination-actions/src/destinations/mixpanel/identifyUser/generated-types.ts @@ -1,6 +1,10 @@ // Generated file. DO NOT MODIFY IT BY HAND. export interface Payload { + /** + * The IP address of the user. This is only used for geolocation and won't be stored. + */ + ip?: string /** * The unique user identifier set by you */ diff --git a/packages/destination-actions/src/destinations/mixpanel/identifyUser/index.ts b/packages/destination-actions/src/destinations/mixpanel/identifyUser/index.ts index 17c4542018..8dc4a046a7 100644 --- a/packages/destination-actions/src/destinations/mixpanel/identifyUser/index.ts +++ b/packages/destination-actions/src/destinations/mixpanel/identifyUser/index.ts @@ -10,6 +10,14 @@ const action: ActionDefinition = { 'Set the user ID for a particular device ID or update user properties. Learn more about [User Profiles](https://help.mixpanel.com/hc/en-us/articles/115004501966?source=segment-actions) and [Identity Management](https://help.mixpanel.com/hc/en-us/articles/360041039771-Getting-Started-with-Identity-Management?source=segment-actions).', defaultSubscription: 'type = "identify"', fields: { + ip: { + label: 'IP Address', + type: 'string', + description: "The IP address of the user. This is only used for geolocation and won't be stored.", + default: { + '@path': '$.context.ip' + } + }, user_id: { label: 'User ID', type: 'string', @@ -79,6 +87,7 @@ const action: ActionDefinition = { const data = { $token: settings.projectToken, $distinct_id: payload.user_id, + $ip: payload.ip, $set: traits }