Comments (8)
Some ideas of what needs to be instrumented:
User interactions:
- copy/paste
- when a user makes their first edit
- CSS: when a new example is selected
- JS: when 'run' is clicked
Performance:
- time to samples being interactive (we might get this for free with GA)
from interactive-examples.
Yeah, the Navigation Timing API is perfect for that :)
I thought of something else we need to track: error messages. I think it's possible broken examples won't run at all but if they do it would be nice to be able to watch for them.
What we do in kuma might be a good starting point.
from interactive-examples.
After having looked at this some and considering our options, I propose we do the following:
Inisde interactive-examples
We use postMessage
as follows
// run button is clicked
mceAnalytics.trackRunClicks();
The above will happen in the events.js
file where we will track all events happening on the editor.
https://github.com/mdn/interactive-examples/blob/master/js/editor-libs/events.js
This will then call the code here:
https://github.com/mdn/interactive-examples/blob/master/js/editor-libs/analytics.js#L11
Inside analytics.js on Kuma
// Adding to globally available mdn object
var analytics = mdn.analytics = {
/**
* Handles postMessage events from the interactive editor, passing of
* the data to `trackEvent` if the origin of the message is what we expect.
* @param {Object} event - The event Object received from the postMessage
*/
interactiveExamplesEvent: function(event) {
if (event.origin !== 'https://mdn.github.io') {
return false;
}
this.trackEvent(event.data);
},
...
};
// add event listener for postMessages from the interactive editor
win.addEventListener('message', analytics.interactiveExamplesEvent, false);
Thoughts? @stephaniehobson @wbamberg
from interactive-examples.
I like the use of postMessage 👍
The ga object can take a callback. For security reasons I would like kuma to strip the callback out of the data before passing it to trackEvent.
from interactive-examples.
For security reasons I would like kuma to strip the callback out of the data before passing it to trackEvent.
Definitely. We would not want to just trust the because the domain matches all is ok.
from interactive-examples.
Pull request for the Kuma side: mdn/kuma#4305
from interactive-examples.
Hey Schalk, can you confirm that we are tracking all events listed by Stephanie?
from interactive-examples.
As we are posting messages to MDN for GA, I reckon we need to calculate the time it took for the iframe to load. It seems the best way to accomplish this would be to use the Navigation Timing API - https://caniuse.com/#feat=nav-timing Thoughts @stephaniehobson @wbamberg
from interactive-examples.
Related Issues (20)
- [meta] Should we archive the wiki? HOT 1
- [meta] Ci can skip more types of changes HOT 1
- whitespace-example without whitespace included in code HOT 1
- [meta] CI runs on forks
- `::marker` class showing XML error HOT 2
- Prettier config deviates from mdn/content HOT 2
- Article element in a wrong implementation HOT 5
- :nth-child - update example to be inclusive HOT 5
- `npm install` has `2 vulnerabilities (1 moderate, 1 high)` HOT 2
- `1 moderate severity vulnerability` when running `npm install` HOT 2
- `Array.prototype.reduce()` demo requires horizontal scrolling HOT 7
- Expected output is wrong HOT 2
- Live example on the groups and backreferences page has inconsistent name HOT 3
- try it confusion HOT 2
- css.properties.backdrop-filter - The Firefox WebDev tool says invalid property name although it is running latest edition HOT 1
- Create an interactive example for `HWB()` HOT 5
- Example HTML Dialog HOT 3
- unnecessary css property in an interactive element HOT 3
- 'space-evenly' (and maybe others) in the demo looks odd given the use of grid-gap HOT 1
- Primary application A is nested with subapplication B, and subapplication B is nested with subapplication C. The font icon of subapplication C cannot be displayed HOT 2
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 interactive-examples.