-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Per Google Analytics docs, user_id
is required in order to identify a user (to differentiate new user with an existing returning user).
It is also required when sending user_data
.
fetch(`https://www.google-analytics.com/mp/collect?measurement_id=${measurement_id}&api_secret=${api_secret}`, {
method: "POST",
body: JSON.stringify({
client_id: 'XXXXXXXXXX.YYYYYYYYYY',
user_id: "XXX",
events: [{
name: 'purchase'
}],
user_data: {
sha256_email_address: yourEmailSha256Variable,
sha256_phone_number: yourPhoneSha256Variable,
address: {
sha256_first_name: yourFirstNameSha256Variable,
sha256_last_name: yourLastNameSha256Variable,
sha256_street: yourStreetAddressSha256Variable,
city: yourCityVariable,
region: yourRegionVariable,
postal_code: yourPostalCodeVariable,
country: yourCountryVariable
}
}
})
});
However, looking at the code, it is only sending client_id
, not user_id
.
const payload = {
client_id: this.clientID,
events: [
{
name: eventName,
params: {
session_id: this.sessionID,
...this.customParams,
},
},
],
};
Happy to open a PR if you think this issue should be addressed.
Metadata
Metadata
Assignees
Labels
No labels