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

Custom dimension and Event data not matching #176

Open
gsvin99 opened this issue Apr 22, 2022 · 0 comments
Open

Custom dimension and Event data not matching #176

gsvin99 opened this issue Apr 22, 2022 · 0 comments

Comments

@gsvin99
Copy link

gsvin99 commented Apr 22, 2022

Hi Team,
I'm using electron application to send google analytics data. Custom dimention report count not match event data.
Please help me to resolve this issue.

Could you please confirm, setting presistent parameters is reset or it will append if pass new dimension value.
This issue happen due to not reset custom mension and mapping wrong data in google anaytics?

Code:
//** Universal Analytics - start **/
const ua = require('universal-analytics');
const { v4: uuidv4 } = require('uuid');
const { JSONStorage } = require('node-localstorage');
const nodeStorage = new JSONStorage(app.getPath('userData'));

// Retrieve the userid value, and if it's not there, assign it a new uuid.
const userId = nodeStorage.getItem('userid') || uuidv4();

// (re)save the userid, so it persists for the next app session.
nodeStorage.setItem('userid', userId);

//Initialize universal-analytics
const usr = ua(env.gaAccountId, userId);

function trackEvent(category, action, label, value, dimensionIndex, dimensionValue) {
//setting persistent parameters
if (dimensionIndex) {
usr.set(dimensionIndex, dimensionValue);
}
usr
.event({
ec: category,
ea: action,
el: label,
ev: value,
})
.send();
}

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

No branches or pull requests

1 participant