Comments (2)
Hey
I just tested that and I think you're right.
If
app.use(ua.middleware(config.ga.key, {
cookieName: '_ga'
}));
is BEFORE app.use(cookieParser())
then Universal Analytics does not seem to find the cid
that is stored in the cookie and it creates a new one (something in the form of 53816753-23f6-4839-8eed-c99bd6bf33d6
).
But if Universal Analytics is AFTER cookieParser then the cid
is the same as in the cookie that is stored in the browser (something like 2114748171.1452681493
).
I'm not sure if this is a bug of Universal Analytics or intended behaviour. Of course it makes sense that cookies only work properly if cookieParser() is before Universal Analytics. The format 53816753-23f6-4839-8eed-c99bd6bf33d6
still looks odd though.
Anyway, what I noticed is that I had a lot of (not set)
values in my Google Analytics Dashboard and now that I looked at it again, I realized, that I actually had the Universal Analytics code BEFORE the cookieParser() in my Express.js config. (Like you described)
So I guess a new cid
was generated every time I sent a custom tracking event. Thus Google Analytics was not able to match the back-end cid
to the font-end cid
resulting in (not set)
values.
Is this assumption correct? Can somebody confirms this?
Best,
Sandro
from universal-analytics.
@sandromartis yes, middlewares are used in the order they are defined in your code, if cookieParser
is used after then it only parses the cookies after this middleware. Order of use is important for every middleware, nothing to do with this one.
I guess it would be worth mentioning in the README
from universal-analytics.
Related Issues (20)
- Ad tracking? HOT 1
- Vulnerability in "request" sub-package HOT 6
- Typescript support? HOT 1
- How to mark event as "User" (raising login event won't mark thing as user) HOT 1
- Custom dimensions with E-commerce tracking HOT 1
- GA + UA HOT 2
- 'Cannot read properties of undefined (reading '_readableState')' error occurred after 0.5.0 update HOT 2
- Payload data sent as object not working HOT 2
- IP not being assigned when using a proxy HOT 2
- Requests are being ignored by GA HOT 5
- Support for Event Values as String HOT 4
- Analytics no longer sent since upgrade from 0.4.23
- Transaction is not reflected being reflected on GA dashboard HOT 2
- Transactions are not being reflected on GA dashboard HOT 3
- Custom dimension and Event data not matching
- Universal Analytics Deprecation HOT 3
- Active users count differently with and without `strictCidFormat`
- Yarn problem with WebpackEncore
- Separate License file?
- Using HTTP proxy
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from universal-analytics.