kidgodzilla / event-layer Goto Github PK
View Code? Open in Web Editor NEWA very simple analytics abstraction layer. Write your events once, then send them where ever you want.
License: MIT License
A very simple analytics abstraction layer. Write your events once, then send them where ever you want.
License: MIT License
I believe the README section regarding "fully tested / considered stable & production-ready" integrations could be a bit more clear.
Perhaps adding a table, instead of an unordered list, containing integration, and a checkmark for stable, would be better. E.g.:
Integration | Stable |
---|---|
Google Analytics | ✔️ |
MyAnalytics.com | |
✔️ |
Looking for contributors to set up testing environments and try out integrations in a live environment. Currently, only 13 integrations have been tested (but more testing is welcome for these as well).
https://kidgodzilla.github.io/event-layer/
[Error] Failed to load resource: the server responded with a status of 404 () (event-layer.js, line 0)
[Error] ReferenceError: Can't find variable: EventLayer
Code général (event-layer:175)
[Error] TypeError: undefined is not an object (evaluating 'Analytics.track')
onclick (event-layer:166)
Hi there,
This is not an issue, requesting integration to gtag.js.
The global site tag (gtag.js) is a JavaScript tagging framework and API that allows you to send event data to Google Analytics, Google Ads, and Google Marketing Platform.
doc: https://developers.google.com/analytics/devguides/collection/gtagjs
Glad to hear your thoughts on this.
Thank you.
There is quite a bit of repeated code. Also the logic of asking for the tracker (taking the first one by default) and using the queue if no tracker is available could be simplified for instance by using the generic queue directly.
Even if the tracker logic wants to be kept, there is also opportunity to consolidate the the tracker checking into a generic "get_tracker" function (with ES6 code can be quickly assigned with something like:
tracker = tracker || get_tracker () (the transpiling for older browsers is not quite clean TBH, so I am not sure if it's a good thing to do if you want to keep highly compatible code in the library)
Also happy to work on this, I already built a quite promising a compact version of the code to be discussed, but would like to hear your thoughts before.
Hello!
Looking for additional analytics or product integrations?
Let us know, and we will work with you to get it added!
Hi there,
This is not an issue, requesting integration to Sendinblue.
doc: https://developers.sendinblue.com/docs/gettings-started-with-sendinblue-tracker
Glad to hear your thoughts on this.
Thank you.
Hey, can you add some info here around licensing the code? https://github.com/angular/angular.js/blob/master/LICENSE
Hi, I use the event-layer on react native projects? (Similarly on server-side or CLI scripts I wrote)
Hi James, this project already looks interesting! Do you have any plans on dynamically adding and initialising the required scripts from integrations? Eg. when I add Intercom as an integration, I can initialise and boot Intercom through Electric love, just like analytics.js (Segment) does?
Not sure if this is on purpose, but I would expect to be able to just call EL.page() (or EL.page(propertiesObject) and get a pageview sent to the providers (with page name calculated by default with something like location.path). The logic implemented at the level of the generic page function in EL does not handle well this cases, and pageviews can be missed (for instance in segment, as the "name" parameter ends up empty, no hit is sent).
of course this can be taken care by something like page(null, null, properties), but at least in Segment it is strange to be even forcing to have a "name" (as the library will take care of that itself with default variables)
Happy to discuss and contribute
Currently experienced some difficulty with async script loads, in particular for google analytics and anayltics.js (segment).
EventLayer expects some of the global variables to be created and in some cases in 'ready' state.
There are several alternatives, and part of this could be taken care in a separate place (with or without changes in EL):
GA:
the entire functioning is a single queue where instructions are passed as literals, so this is quite easy:
analytics.js:
Ultimately, it seems it's about creating dummy objects and either mock up states and properties (loaded, Integrations), and making sure the "test" methods are consistency.
I can see 3 broad approaches:
Looking forward to hear your thoughts and happy to contribute to address this.
thanks!
Currently, the adapter code is 70% of the actual script. Are there plans in the future to use ES6 import statement, to make sure Webpack and the likes only compile and include actually used integrations? Would be a nice improvement!
Hi there,
This is not an issue, more like a feature.
Right now Google has on Beta a new way of tracking, called Google Analytics Web+App.
It works different from traditional analytics, so if not on the code, we need to send events to all platforms + GA. It's possible, but it loses the main purpose of this.
This is not supported right now on your code, but it would be great if it does :)
Apparently it's based on Firebase Analytics and it's highly focused on events (just like this plugin!)
Glad to hear your thoughts on this.
Thanks a lot!!
Hi,
Trying to add the code to GTM, it breaks. The explanation of GTM is this:
Error at line 202, character 45: This language feature is only supported for ECMASCRIPT6 mode or better: default parameter.
The line that is affected is this one:
page: function (category, name, properties={}) {
Is there a way to fix this?
Thanks!
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.