adorable-refrigerator-48072
06/19/2023, 9:53 AMmillions-activity-52391
06/19/2023, 9:53 AMquiet-wolf-72320
06/19/2023, 1:32 PMadorable-refrigerator-48072
08/29/2023, 5:42 PMcompany_id from the JS will be mapped with field company_id under Redshift. Now it is mapped to a new field context_traits_company_id
Is there anyway I can map this field from JS back to the original field?millions-activity-52391
08/30/2023, 11:50 AMmillions-activity-52391
08/30/2023, 2:42 PMadorable-refrigerator-48072
08/31/2023, 6:30 AM[
{
"anonymousId": "745563ea-743d-4206-8f46-768057d44715",
"channel": "web",
"context": {
"app": {
"name": "RudderLabs JavaScript SDK",
"namespace": "com.rudderlabs.javascript",
"version": "2.35.0"
},
"campaign": {},
"library": {
"name": "RudderLabs JavaScript SDK",
"version": "2.35.0"
},
"locale": "en-US",
"os": {
"name": "",
"version": ""
},
"page": {
"initial_referrer": "$direct",
"initial_referring_domain": "",
"path": "/projects/228",
"referrer": "$direct",
"referring_domain": "",
"search": "",
"tab_url": "<https://app.gridly.com/projects/228>",
"title": "Gridly Interactive | Gridly",
"url": "<https://app.gridly.com/projects/228>"
},
"screen": {
"density": 2,
"height": 1050,
"innerHeight": 920,
"innerWidth": 1660,
"width": 1680
},
"sessionId": 1693463291883,
"traits": {
"avatar": "<https://eu-central-1.api.gridly.com/organization/api/v1/media/avatars/qTOZA14Z72ODfo5CO2tXUlC8YNJ4Q.png>",
"company": {
"id": "1601969160001",
"name": "Gridly Interactive",
"plan": "UNLIMITED"
},
"createdAt": "2021-11-23T10:36:00Z",
"email": "<mailto:tnn@localizedirect.com|tnn@localizedirect.com>",
"firstName": "Thy",
"lastName": "Nguyen",
"projectId": 228
},
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36"
},
"event": "[Gridly] Open Add Grid Option",
"integrations": {
"All": true
},
"messageId": "00a20a95-6799-46b1-801e-afa373bf9c21",
"originalTimestamp": "2023-08-31T06:29:50.037Z",
"properties": {},
"rudderId": "76c48ec6-6d3c-4dc3-9b5b-fbea29f51d9f",
"sentAt": "2023-08-31T06:29:50.040Z",
"type": "track",
"userId": "4051194393784320"
}
]adorable-refrigerator-48072
08/31/2023, 6:32 AMgridly I'm not the dev, so I'm not sure what you mean by upgrading the server versionmillions-activity-52391
08/31/2023, 12:21 PMexport function transformEvent(event, metadata) {
const session_id = event.context?.sessionId;
if (session_id) {
event.session_id = session_id;
delete event.context.sessionId;
}
if (event.type === 'track') {
const company = { ...event.context?.traits?.company};
event.properties = {company, ...event.properties};
delete event.context?.traits?.company;
}
return event;
}shy-kite-21035
08/31/2023, 12:26 PM[
{
"anonymousId": "745563ea-743d-4206-8f46-768057d44715",
"channel": "web",
"context": {
"app": {
"name": "RudderLabs JavaScript SDK",
"namespace": "com.rudderlabs.javascript",
"version": "2.35.0"
},
"campaign": {},
"library": {
"name": "RudderLabs JavaScript SDK",
"version": "2.35.0"
},
"locale": "en-US",
"os": {
"name": "",
"version": ""
},
"page": {
"initial_referrer": "$direct",
"initial_referring_domain": "",
"path": "/projects/228",
"referrer": "$direct",
"referring_domain": "",
"search": "",
"tab_url": "<https://app.gridly.com/projects/228>",
"title": "Gridly Interactive | Gridly",
"url": "<https://app.gridly.com/projects/228>"
},
"screen": {
"density": 2,
"height": 1050,
"innerHeight": 920,
"innerWidth": 1660,
"width": 1680
},
"sessionId": 1693463291883,
"traits": {
"avatar": "<https://eu-central-1.api.gridly.com/organization/api/v1/media/avatars/qTOZA14Z72ODfo5CO2tXUlC8YNJ4Q.png>",
"company": {
"id": "1601969160001",
"name": "Gridly Interactive",
"plan": "UNLIMITED"
},
"createdAt": "2021-11-23T10:36:00Z",
"email": "<mailto:tnn@localizedirect.com|tnn@localizedirect.com>",
"firstName": "Thy",
"lastName": "Nguyen",
"projectId": 228
},
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36"
},
"event": "[Gridly] Open Add Grid Option",
"integrations": {
"All": true
},
"messageId": "00a20a95-6799-46b1-801e-afa373bf9c21",
"originalTimestamp": "2023-08-31T06:29:50.037Z",
"properties": {},
"rudderId": "76c48ec6-6d3c-4dc3-9b5b-fbea29f51d9f",
"sentAt": "2023-08-31T06:29:50.040Z",
"type": "track",
"userId": "4051194393784320"
}
]
Transformed payload:
[
{
"anonymousId": "745563ea-743d-4206-8f46-768057d44715",
"channel": "web",
"context": {
"app": {
"name": "RudderLabs JavaScript SDK",
"namespace": "com.rudderlabs.javascript",
"version": "2.35.0"
},
"campaign": {},
"library": {
"name": "RudderLabs JavaScript SDK",
"version": "2.35.0"
},
"locale": "en-US",
"os": {
"name": "",
"version": ""
},
"page": {
"initial_referrer": "$direct",
"initial_referring_domain": "",
"path": "/projects/228",
"referrer": "$direct",
"referring_domain": "",
"search": "",
"tab_url": "<https://app.gridly.com/projects/228>",
"title": "Gridly Interactive | Gridly",
"url": "<https://app.gridly.com/projects/228>"
},
"screen": {
"density": 2,
"height": 1050,
"innerHeight": 920,
"innerWidth": 1660,
"width": 1680
},
"traits": {
"avatar": "<https://eu-central-1.api.gridly.com/organization/api/v1/media/avatars/qTOZA14Z72ODfo5CO2tXUlC8YNJ4Q.png>",
"createdAt": "2021-11-23T10:36:00Z",
"email": "<mailto:tnn@localizedirect.com|tnn@localizedirect.com>",
"firstName": "Thy",
"lastName": "Nguyen",
"projectId": 228
},
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36"
},
"event": "[Gridly] Open Add Grid Option",
"integrations": {
"All": true
},
"messageId": "00a20a95-6799-46b1-801e-afa373bf9c21",
"originalTimestamp": "2023-08-31T06:29:50.037Z",
"properties": {
"company": {
"id": "1601969160001",
"name": "Gridly Interactive",
"plan": "UNLIMITED"
}
},
"rudderId": "76c48ec6-6d3c-4dc3-9b5b-fbea29f51d9f",
"sentAt": "2023-08-31T06:29:50.040Z",
"type": "track",
"userId": "4051194393784320",
"session_id": 1693463291883
}
]
Note:- This has only been tested on the payload you provided and needs to be tested on other sample payloads before being used in production.