Skip to main content

I currently have a custom event set up to capture user log in through Auth0 using Amplitude’s HTTP API. When I inspect the event in Users and Sessions I can see that it captured standard user properties like user id, device id, country, ect. I was wondering if it’s possible for me to send any custom data with this event. This is the code I wrote:

exports.onExecutePostLogin = async (event, api) => {
const fetch = require('node-fetch');

const response = await fetch('https://api2.amplitude.com/2/httpapi', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': '*/*'
},
body: JSON.stringify({
"api_key": event.secrets.API_KEY,
"events": s{
"event_type": "User log in"
}]
})
})

Let’s just say for an example I wanted to capture the user email or log in time, would it be possible for me to capture this information? Currently, when I add a key value pair to the events array in the body like `email: myemail@gmail.com` this information isn’t captured. 

Hi @drpmldev 

The payload supports user properties as well. Here’s a sample upload request

https://www.docs.developers.amplitude.com/analytics/apis/http-v2-api/#upload-request
 

 


Hi @drpmldev 

The payload supports user properties as well. Here’s a sample upload request

https://www.docs.developers.amplitude.com/analytics/apis/http-v2-api/#upload-request
 

 

Thanks! Would these custom user properties have to first be defined on the Amplitude side somewhere or would is it not necessary? Like, if I just pushed a property called “internal_user” as part of the payload in user_properties without having done anything on the Amplitude side, would that property still be captured?


Yes, the property would still be ingested. On the governance side, if you haven’t planned that property yet in the Data UI, then it will appear under “Unexpected”. You can add this to your tracking plan upon ingestion.


Reply