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

save user._id to storage after track, and use in conversion event #190

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ShiCheng-Lu
Copy link

@ShiCheng-Lu ShiCheng-Lu commented Nov 18, 2024

Save user._id from track result to be used in conversion event. Which is the current behavior of mobile sdks.

It doesn't look like the userId takes priority over the deviceId/installId, so if there is a mismatch, it still logs to the user associated with deviceId/installId.
So I concluded that this endpoint is not meant to be able to log a conversion for a different user than the current logged in user.
Which means that if we do have an _id, there is no reason not to use it.
(originally, I had it where it only uses _id if none of the other parameters are provided, or is the same as the saved value, but this is not necessary if the conversion call should only post event for the current user).

Tested with the demo app:

  • track once (saves the _id to storage)
  • log conversion without any field in the userId input
  • this should result in id being populated in the POST event API call, and event is logged in dashboard.
Screenshot 2024-11-18 at 3 03 14 PM Screenshot 2024-11-18 at 3 03 20 PM Screenshot 2024-11-18 at 5 03 35 PM

Copy link

Choose a reason for hiding this comment

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

Should also send _id up in track if it exists (makes subsequent tracks more performant).

@ShiCheng-Lu ShiCheng-Lu marked this pull request as ready for review November 18, 2024 22:04
const deviceId = params.deviceId || Device.getDeviceId();
const installId = params.installId || Device.getInstallId();
const sessionId = Session.getSessionId();
const locationAuthorization = await Navigator.getPermissionStatus();

const data = {
const data: any = {
id,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just to verify, id is the correct param (not _id)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants