samverschueren / angular-ga Goto Github PK
View Code? Open in Web Editor NEWGoogle Analytics for your Angular application
License: MIT License
Google Analytics for your Angular application
License: MIT License
It is not working with measurement id provided by google analytics.
I am trying to implement event tracking using this Extension. However it is giving me error ERROR Error: Could not load GA
.
I analysed 1 thing that it is not working with measurement id (i.e., 'G-XXXXXXX') provided in new Analytics account . However event tracking is working when i use tracking id(i.e., 'UA-XXXXX') of any old project. So, will this extension not work for new projects. Or is there any workaround.
Hi -- Is there a demo page somewhere to demonstrate how to use this lib in Angular? I'd like to see how to make the various GA tracking calls through your lib.
Thanks!
Heey we are currently using angular-ga and all has been working great.
However we now need to add anonymization to it aswell and there doesn't seem to be a configuration for this?
Normally one would do
gtag('config', '<GA_MEASUREMENT_ID>', { 'anonymize_ip': true });
which makes this work however for us it doesn't seem to work..
In our appModule we have the following:
private gtag(...args: any[]) {
const win = window as { [key: string]: any };
const dataLayer = win['dataLayer'] = win['dataLayer' as any] || [];
dataLayer.push(args);
}
private initializeGoogleAnalytics() {
this.gtag('js', new Date());
this.gtag('config', environment.gaToken, { 'anonymize_ip': true });
}
We call this for every router event
Help is much appreciated!
EDIT: Official docs -> https://developers.google.com/analytics/devguides/collection/gtagjs/ip-anonymization
Can you add the other optional params for the configure method in your code? This would be much appreciated!
Google allows several more params to the create call which include "name" and "userId". You currently only provide 2 params - trackingId and cookieDomain. It seems like all you have to do is modify these 2 lines of code in your angular-ga.js file:
configure(trackingId, options = 'auto') {
ga('create', trackingId, options);
This is from the Google Analytics site - https://developers.google.com/analytics/devguides/collection/analyticsjs/creating-trackers#working_with_multiple_trackers
ga('create', {
trackingId: 'UA-XXXXX-Y',
cookieDomain: 'auto',
name: 'myTracker',
userId: '12345'
});
Hi,
I would like an option to prevent the configure method on the gaService from sending a pageview. I have some re-write rules within the application that I run before sending a pageview to GA which are not taken into account when using this library.
If so, how do I do it? I am struggling to send custom fields, such as the user id. I would really appreciate any help.
Thanks in advance
I should also ship the module with an UMD bundle to make sure everyone can easily use the module.
It doesn't seem to work with AoT, not sure why though. I'm using angular-cli
and while ng serve
runs perfectly, ng build --prod --aot
fails with the following error.
ERROR in Error encountered resolving symbol values statically. Calling function 'makeDecorator', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function
I have no clue whatsoever.
@ocombe Any ideas? I'm really in the dark with this one and have no clue about what could cause this issue.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.