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

Add feature to use uid only without cid #122

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

Conversation

puttpotsawee
Copy link

Hi, I have recently come across GA lately and found your lib really useful.

I mostly use it to send some analytics data from the backend. My project analyzes mainly with UserId since we focus on user conversion etc.

Yesterday, I began to create custom dimensions for the user scope. I have an API fire the event when a user updates his status. I found the value in the custom dimensions are wrong when the user rapidly submits the update, even if it updates a different index of the custom dimensions.

2018-12-25T08:12:42.530Z universal-analytics Enqueued event ({ ea: 'Create Profile', ec: 'Backend', cd2: 'buyer', v: '1', tid: 'UA-XXXXXXXX', cid: '2aa7e81f-7787-46a1-a3fb-7d7335ba5127', t: 'event', uid: '5c21e678f001ab001a9200be' })

2018-12-25T08:12:42.541Z universal-analytics Enqueued event ({ ea: 'Update Profile', ec: 'Backend', cd1: 'in-house', cd2: 'seller', cd3: 'partner1', v: '1', tid: 'UA-XXXXXXXX', cid: '589f3a49-52cd-4fca-a7ad-c94a6dbb2b99', t: 'event', uid: '5c21e678f001ab001a9200be' })

My Custom dimensions are

Index Field Name
cd1 subType
cd2 userType
cd3 userPartner

In the analytic dashboard, the UserExplorer shows this userID with 2 events, Create Profile and Update Profile. But these events appear to be in different sessions.

The custom dimensions are showing

{subType: undefined, userType: "buyer", userPartner: undefined}

I figure the cid is the problem for my case, I tried the same event firing directly to the Measurement Protocol API without the cid and the data works fine. In this case, it shows:

{subType: "in-house", userType: "seller", userPartner: "partner1"}

According to the Measurement Protocol Reference, the cid and uid can be either one.

So I create an option identifyByUserId which check if the uid is supplied then the auto-generate cid will not be run.

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.

1 participant