Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Aubry <matt@piwik.org>2014-08-25 21:33:52 +0400
committerMatthieu Aubry <matt@piwik.org>2014-08-25 21:33:52 +0400
commit02c70237727850b4f83e65187ce46b4710755817 (patch)
treea93e95836f580a8c3fe927cfb2460474ac32033f /misc/internal-docs
parent63152188a1f1a28781046080831a4cabbf18e7c9 (diff)
Replying to first questions, refs #4996
Diffstat (limited to 'misc/internal-docs')
-rw-r--r--misc/internal-docs/content-tracking.md86
1 files changed, 86 insertions, 0 deletions
diff --git a/misc/internal-docs/content-tracking.md b/misc/internal-docs/content-tracking.md
index 00e8c5a44f..e1600a01c5 100644
--- a/misc/internal-docs/content-tracking.md
+++ b/misc/internal-docs/content-tracking.md
@@ -10,23 +10,88 @@ This is the technical concept for implementing content tracking. We won't plan a
## Further Questions
1. Can the same content piece have different names / targets? Can the same content name have different targets/pieces?
+
+Maybe the unique ID of a Content can be the { Content name + Content piece }. Then we would recommend users to set the same Content target for a given tuple { Content name, Content piece }.
+
+I hope it makes sense to assume this tuple will have always same Content target by design?
+
+In this case I would modify questionas as follows:
+ * Can the same content piece have different names? Yes (eg. a banner image is used by different Content names),
+ * Can the same { content name, content piece } have different targets? Yes, but it's not recommended: Piwik will only aggregate one content target value. (eg. keep the latest content target value tracked for this { content name, content piece } tuple on a given day)
+
+
2. Are we always assuming the "conversion" or "target URL" is caused by a click or can it be a hover or drag/drop, ...? For a general solution we might want to assume it can be anything?
* In this case we would also rename or need an additional attribute or whatever to [data-trackclick] etc.
+
+When drag and dropping there is a click needed by user, so maybe `data-trackclick` would still be OK in this case?
+if you have better naming idea feel free to suggest. Or maybe you have other use cases besides clicks and drag n drop?
+
3. Would a piece of content - such as a banner - have maybe custom variables etc?
+
+It would be nice to be able to set custom variables to Contents.
+
+One possible use case is A/B testing. Maybe it would make sense to use Contents plugin for A/B testing. We could measure Content name = Experiment_TopMenu, Content piece = http://host/a.jpg. In a custom variable we would store "experiment => B". Then we would know that the given experiment is called Experiment_TopMenu and is defined by the image and that it's the variant B being served.
+
4. How do we present the data in a report? Similar to events with second dimensions? Probably depends on 1)
+
+Second dimension would be really powerful to have (as per suggestion in 1)). It would let user see different banner images for a given banner name.
+
+There would be two reports:
+ * First dimension: Banner Names, Second dimension: Banner pieces
+ * First dimension: Banner pieces, Second dimension: Banner names
+
+(It's a bit simpler than Events because we don't need to switch the second dimension.)
+
5. I assume there can be nested content in theory. A piece of content that contains another piece of content. In this case we have to be careful when automatically picking name, target, ...
+
+Nested content makes sense (users will do this). How would it work when several contents are nested?
+Note: we don't need to handle this case in MVP but maybe worth thinking about it.
+
6. FYI: We would probably also need an attribute like data-target="$target" and/or the possiblity for data-trackclick="$target" since not all links might be defined via href but onclick javascript links. See next section
+
++1
+
7. HTML Attributes always take precendence over css classes or the other way around (if both defined)? I think attributes should take precendence which I think is also defined in the spec
+
+attributes take precedence over CSS classes
+
8. Do we need to support IE7 and older? Firefox 3 and older?
+
+Support modern browsers is enough (ie. last 2 years or so?).
+
9. "Maybe we could automatically detect when such element becomes visible, and send the Impression event automatically"
* I think we can detect whether a specific content was visible at a specific time in most cases but not necessarily automatically. We would have to check the DOM for this every few ms (in case of Carousel) and we'd also have to attach to events like scrolling etc. This can make other peoples website slow, especially on mobile but even browser. Website owners usually want to achieve 60fps to have animations and scrolling smooth and they usually invest a lot of time to achieve this. So it has to an opt-in if at all
+
+in case user tags an element with `data-noautotrack` then it's already a kind of opt-in by user, so maybe in this case it's acceptable to check whether element tagged is visible, eg. every 500 ms ?
+
* Do I understand it right that we send an impression only if it is visible?
+
+Yes.
+
* We'd probably have to offer a mode to send all banners independend of visibility
+
+Sounds good: this would make Contents plugin more generic.
+
+
* We'd probably have to offer a mode to rescan all banners again at a certain time and only track those content pieces now that were not visibile before but are now
+
+In ticket I wrote `function trackContentPieces() that will let users re-scan the page for Content pieces when DOM has changed.` but maybe instead the function should be called `rescanPageForContents` ?
+
* We'd probably have to offer a method to pass a DOM node and track it independent of visibility (useful for instance in case of carousel when the website owner already knows a specific content piece is visible now but does not want to use expensive events for this)
+
+if I understand correctly it would make life of JS developers easier by providing nicer APIs to them?
+
+so +1
+
* We'd maybe have to offer a mode where we are trying to detect automatically when an impression becomes visible and send it
+
+I think that should be the default mode, ie. on page load we detect impressions, and then we also attach to events like scrolling to check ie. every 500ms whether a given Contents is visible. Would that be work?
+
10. FYI: "you may add a CSS class or attribute to the link element to track" => It could be also a span, a div or something else
11. FYI: There is way to much magic how content-name is found and it is neither predicatble nor understandable by users, I will simplify this and rather require users to set specific attributes! See next section
+
+OK
+
12. FYI: We need to define how a content piece is defined in markup since it can be anything (was something like piwik-banner before) see next section
## Tagging of the content piece declarative
@@ -51,11 +116,25 @@ Solution 2
Thomas definitely prefers solution 2.
+Matthieu feedback about solution 2:
+
+> Use value of content-piece in case there is one
+Maybe only the path of the content-piece or even only the content-piece filename should be used?
+
+> If neither found ignore content or use "Unknown"
+Before ignoring content or setting content-name to "Unknown", maybe it would be user friendly to read the first "title" attribute found in `.piwikTrackContent` (and its children).
+
+(But I'm not pushing this since it's not that important, if you think it's better to have only clear attribute names then I'm OK with it... As long as we document things clearly then it will be fine for users)
+
+Btw: i18n text should not be an issue, btw we have logic to convert to UTF-8 any content not set in UTF-8 (see [piwik.js](https://github.com/piwik/piwik/blob/master/js/piwik.js#L1772-1772) and [example tracker code](https://github.com/piwik/piwik/blob/master/plugins/Actions/Actions/ActionSiteSearch.php#L133-135))
+
+
### New proposed way of finding content target
* Search for any `data-track-click` attribute with a value in the content (`.piwikTrackContent` and children)
* search for `href` attribute in element with attribute `data-track-click` (if attribute has no value)
* search for `href` attribute in element with css class `.piwikTrackClick`
* TODO `click` in attribute name and css class is misleading since it could be a hover or so as well? `conversion` would be misleading as well since it could be used for goal
+ * Maybe we call it `data-track-interaction`?
### New proposed way of finding content piece
* If attribute `data-track-content` has a value, we will use this value whatever it is
@@ -64,6 +143,13 @@ Thomas definitely prefers solution 2.
* if `.piwikTrackClick` is image or video we will try to find a source (difficult for video)
* if `.piwikTrackContent` and `.piwikTrackClick` is not image or video we will use `text()` of this element??? (I think we better ignore this step, text can be a lot and problems with i18n makes it not useful at all?)
* Note: source of image/video and any text() that we detect automatically can be complicated in case of i18n, it will be recommended to use data-track-content attribute
+
+
+
+> text can be a lot and problems with i18n makes it not useful at all
+
+What problems are there with i18n, eg. when the page is in UTF-8? eg. when testing on google.cn to read `$('#addlang').textContent` it shows the content OK.
+
### A few Examples
```