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:
authorThomas Steur <thomas.steur@googlemail.com>2014-09-09 17:37:58 +0400
committerThomas Steur <thomas.steur@googlemail.com>2014-09-09 17:37:58 +0400
commit36b6aed37941afef152bac49d6d4db0f86dcec70 (patch)
treead8991f7d752770dc9dcacff30ea9a3db71eecd0 /misc/internal-docs
parent774611a1b63c9d2e4dca67810ee8c20f442b7611 (diff)
refs #4996 more tests and bugfixes, improved API, some work on crossbrowser support
Diffstat (limited to 'misc/internal-docs')
-rw-r--r--misc/internal-docs/content-tracking.md47
1 files changed, 25 insertions, 22 deletions
diff --git a/misc/internal-docs/content-tracking.md b/misc/internal-docs/content-tracking.md
index 19c950af5a..1df16dc17b 100644
--- a/misc/internal-docs/content-tracking.md
+++ b/misc/internal-docs/content-tracking.md
@@ -302,31 +302,15 @@ A typical example for a content block that displays a text ad.
There are several ways to track a content impression and/or interaction manually, semi-automatically and automatically. Please be aware that content impressions will be tracked using bulk tracking which will always send a `POST` request, even if `GET` is configured which is the default.
-#### `trackContentImpressions()`
+#### `trackAllContentImpressions()`
You can use this method to scan the entire DOM for content blocks.
-For each content block we will track a content impression immediately unless you enable `enableTrackOnlyVisibleContent` see below.
+For each content block we will track a content impression immediately unless you have called `trackVisibleContentImpressions()` before see below.
Note: We will not send an impression of the same content block twice if you call this method multiple times unless `trackPageView()` is called meanwhile. This is useful for single page applications. The "same" content blocks means if a content block has the identical name, piece and target as an already tracked one.
Note: At this stage we do not exeute this method automatically along with a trackPageView(), we can do this later once we know it works
-#### `trackContentImpressionsWithinNode(domNode, contentTarget)`
-
-You can use this method if you, for instance, dynamically add an element using JavaScript to your DOM after the we have tracked the initial impressions. Calling this method will make sure an impression will be tracked for all content blocks contained within this node.
-
-Example
-```
-var div = $('<div>...<div data-track-content>...</div>...<div data-track-content>...</div></div>');
-$('#id').append(div);
-
-_paq.push(['trackContentImpressionsWithinNode', div[0]]);
-```
-
-We would detect two new content blocks in this example.
-
-Please note: In case you have enabled to only track visible content blocks we will respect this. In case it contains a content block that was already tracked we will not track it again.
-
-#### `enableTrackOnlyVisibleContent(checkOnSroll, timeIntervalInMs)`
+#### `trackVisibleContentImpressions(checkOnSroll, timeIntervalInMs)`
If you enable to track only visible content we will only track an impression if a content block is actually visible. With visible we mean the content block has been in the view port, it is actually in the DOM and is not hidden via CSS (opacity, visibility, display, ...).
* Optionally you can tell us to rescan the DOM automatically after each scroll event by passing `checkOnSroll=true`. We will then check whether the previously hidden content blocks are visible now and if so track the impression.
@@ -338,14 +322,33 @@ If you enable to track only visible content we will only track an impression if
* Rescanning the entire DOM and detecting the visible state of content blocks can take a while depending on the browser and amount of content
* We do not really rescan every X milliseconds. We will schedule the next rescan after a previous scan has finished. So if it takes 20ms to scan the DOM and you tell us to rescan every 50ms it can actually take 70ms.
* In case your frames per second goes down you might want to increase this value
-* If you do not want us to perform any checks you can either call `trackContentImpressions()` manually at any time to rescan the entire DOM or `trackContentImpressionsWithinNode()` to check only a specific part of the DOM for visible content blocks.
+* If you do want to only track visible content but not want us to perform any checks automatically you can either call `trackVisibleContentImpressions()` manually at any time to rescan the entire DOM or `trackContentImpressionsWithinNode()` to check only a specific part of the DOM for visible content blocks.
+ * Call `trackVisibleContentImpressions(false, 0)` to initially track only visible content impressions
+ * Call `trackVisibleContentImpressions()` at any time again to rescan the entire DOM for newly visible content blocks or
+ * Call `trackContentImpressionsWithinNode(node)` at any time to rescan only a part of the DOM for newly visible content blocks
-It is recommended to call this method once before any call to `trackContentImpressions` or `trackContentImpressionsWithinNode()`. If you call this method more than once it does not have any effect.
+Note: You can not change the `checkOnScroll` or `timeIntervalInMs` after this method was called the first time.
-#### `trackVisibleContentImpressions(checkOnSroll, timeIntervalInMs)`
+#### `(checkOnSroll, timeIntervalInMs)`
Is a shorthand for calling `enableTrackOnlyVisibleContent()` and `trackContentImpressions()`.
+#### `trackContentImpressionsWithinNode(domNode, contentTarget)`
+
+You can use this method if you, for instance, dynamically add an element using JavaScript to your DOM after the we have tracked the initial impressions. Calling this method will make sure an impression will be tracked for all content blocks contained within this node.
+
+Example
+```
+var div = $('<div>...<div data-track-content>...</div>...<div data-track-content>...</div></div>');
+$('#id').append(div);
+
+_paq.push(['trackContentImpressionsWithinNode', div[0]]);
+```
+
+We would detect two new content blocks in this example.
+
+Please note: In case you have enabled to only track visible content blocks we will respect this. In case it contains a content block that was already tracked we will not track it again.
+
#### trackContentInteractionNode(domNode, contentInteraction)
By default we track interactions depending on a click and sometimes we cannot track interactions automatically add all. See "How do we track an interaction automatically?". In case you want to track an interaction manually for instance on a double click or on a form submit you can do this as following: