Comments (8)
Great! I'll try it today.
Thank you for the article 🙂
from analytics.
Hey @tammaroivan
Custom dimensions were on my list of this to do... 😃
I went ahead and added them: https://github.com/DavidWells/analytics/blob/master/packages/analytics-plugin-google-analytics/src/browser.js#L11
I need to clean up the docs & then I can release a new version for ya.
In the newer version, once released, you can define customDimensions
option and map to your google analytics custom dimensions.
Here is an example:
import Analytics from 'analytics'
import googleAnalytics from '@analytics/google-analytics'
/* initialize analytics and load plugins */
const analytics = Analytics({
app: 'awesome-app',
plugins: [
googleAnalytics({
trackingId: 'UA-1223141231',
// Map your dimensions here
customDimensions: {
baz: 'dimension1',
foo: 'dimension2',
flam: 'dimension3',
},
}),
]
})
// Tracking example with mappings
analytics.track('buttonClicked', {
baz: 'hello',
foo: 'cool'
})
/* This tracking call payload maps to:
{
dimension1: 'hello', ===> baz is mapped to dimension1
dimension2: 'cool' ===> foo is mapped to dimension1
}
Under the hood this sets the custom dimensions in GA:
ga('set', { dimension1: 'hello', dimension2: 'cool' }). */
// Mapping works with identify too
analytics.identify('user123', {
flam: 'wow'
})
/* This identify call payload maps to:
{
dimension3: 'wow', ===> flam is mapped to dimension3
}
a.k.a ga('set', { dimension3: 'wow' }).
*/
Out of curiosity, what are you tracking with custom dimensions? Also, are you using custom metrics at all? Thanks!
from analytics.
Thank you so much for that! Waiting for that release.
I'm dealing with a specific problem. I need reports associated to the user id, I'm identifying the user with analytics.identify
but Google Analytics really doesn't allow you to do so much else than "User Explorer" (or I couldn't find it).
One basic example: I'm saving a specific event and I would like to know which user does this event more times. I couldn't find how to do this with the user id feature but yes with a custom dimension.
I'm not using custom metrics for now, but I'm just starting this project in my company and it will get bigger in the near future.
What do you think? Custom dimension is a good approach for this? Or can I do this with the user id feature?
Thanks!
from analytics.
Alrighty! @analytics/[email protected]
is published with custom dimension support.
Thanks again for reaching out & using the package! 😃
As for which custom dimensions to track, I've always liked Simo's https://www.simoahava.com/analytics/13-useful-custom-dimensions-for-google-analytics/ list.
from analytics.
am i doing something wrong?
I'm not able to load the values sent to customDimensions into Google Analytics
import googleAnalytics from '@analytics/google-analytics'
import Analytics from 'analytics'
const analytics = Analytics({
app: 'app',
version: 100,
plugins: [
googleAnalytics({
trackingId: process.env.GA_TRACKING_ID,
customDimensions: {
feature: 'dimension1',
subfeature: 'dimension2',
version: 'dimension3',
chapter: 'dimension4',
verse: 'dimension5',
ip: 'dimension6',
isHowToUse: 'dimension7'
}
})
]
})
await analytics.track('request', {
feature: 'verses',
subfeature: 'search'
})
Using the default properties (action, category and label) it worked.
In Google Analytics:
from analytics.
Hey @marciovsena
That looks correct as per the docs https://getanalytics.io/plugins/google-analytics/#using-ga-custom-dimensions
Do you have a live project/link I can checkout?
setCustomDimensions
should be getting called here
from analytics.
@DavidWells Yes, I am apparently doing as described in the documentation.
Link of the PR with the implementation:
Application Staging Link:
I was unable to add your hello@davi...
email to the google analytics staging account.
How to test:
- Visit https://bibleapi-stg.herokuapp.com/en
- Go to the
How To Use
section - Search for:
verses/nvi/sl/21
verses/nvi/sl/22
verses/nvi/sl/23
versions/nvi/sl/24
Thank you
from analytics.
To anyone else that was having this issue, i had to manually pull the release. Perhaps a release for this wasn't published.
Doing a fresh npm install was pulling 0.2.2
from analytics.
Related Issues (20)
- Plugin Request: AWS Personalize HOT 1
- @analytics/snowplow not working HOT 1
- Remove user_id as a custom dimension in google-analytics event payload
- Angular warns about using "dlv" – can cause optimization bailouts HOT 2
- Allow URL params for simpleanalytics HOT 2
- Request to upgrade analytics-node to resolve security issue in Axios HOT 2
- Update intercom-client in analytics-plugin-intercom
- Add support for Rudderstack HOT 1
- ga4 support for other protocols HOT 1
- Plugin Request - Server-side Implementation - Google Analytics HOT 3
- Clients throwing error: abort is not a function HOT 6
- Dependency Security: Axios Cross-Site Request Forgery Vulnerability HOT 1
- new Chrome cookie policy warning HOT 1
- OneTrust integration HOT 2
- Google Consent Mode v2 HOT 3
- Google Tag Manager - Consent Mode V2 implementation (Next.js 14)
- Customerio Plugin uses customerio-node v0.5.0
- How to contribute a plugin? HOT 1
- Unloading Plugins based on Path HOT 1
- HTML integration does not recognize Analytics.page analytics.track HOT 3
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 analytics.