Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content Tracking, Banner tracking: track impressions, Clicks on any piece of content #4996

Closed
mattab opened this issue Apr 15, 2014 · 21 comments
Assignees
Labels
c: Platform For Matomo platform changes that aren't impacting any of our APIs but improve the core itself. Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical.
Milestone

Comments

@mattab
Copy link
Member

mattab commented Apr 15, 2014

(Updated: check this internal docs to see up to date specs & discussion)

We want to build a way in Piwik to determine the performance of the pieces of content on any page of the website or app.

Basic requirements

  • Track metrics for banners / content pieces:
    • Impressions,
    • Clicks,
    • CTR (Click-throughs / Impressions)

Note: we assume in the following requirements that a banner is a piece of content on the page - it can be either a whole section of the page (in a <div>), an image/banner ad, or just a text ad/link.

Proposed solution

  • Definition of a content piece (banner)
  • A content piece is an element that is seen and clicked by people, to create traffic to specific parts of the website 
  • A content piece has:
    - Content name,
    - Content image (for a banner) or a Content text (for text ad) - optional,
    - Click URL, where the content links to - optional.
  • Tagging of the content piece
  • you may add a CSS class for the main content element (<div>, <img> or <a>):
    <div class="piwik-trackcontent" id="sample">
  • or you may add a tag "data-trackcontent" to the main content element:
    <div data-trackcontent id="sample">
  • the Click URL, Content Image and Content Name will be detected automatically or can be specified by using CSS class or tag to the link element:
    - the Click URL can be a landing page or a product page. Help Piwik detect this Click URL by tagging your content links elements:
    • by default, Piwik will automatically detect the first link found within the content:
    • you may add a CSS class to the link element to track, <a class="piwik-trackclick" href="{CLICK_URL}">
    • you may add a tag "data-click" to the link element  <a data-trackclick href="{CLICK_URL}">
      - the Content Image is what all visitors see before clicking on the content.
    • by default, Piwik will automatically detect the first image found within the content:
    • alternatively, you may add a CSS class to the image element to use as banner image. 
      <img class="piwik-banner" src="{BANNER_IMAGE}">
    • or add a tag <img data-banner src="{BANNER_IMAGE}">
      - the Content Name must be memorable and distinguishable from others. Piwik will detect the content name by:
    • reading the 'data-name' attribute of the main content element: <div data-name="Content name 1" ...>
    • reading the title element of the main content element: <a href="{CLICK_URL}" data-trackclick title="This is used as content name">
    • reading the title element of the Image found within this link element and used as content image <a href="{CLICK_URL}" data-trackclick> <img title="This is used as content name" src="{BANNER_IMAGE}"> </a>
    • note:
      if data-name=" is not found in the data-trackclick element or any children, piwik will also read the title="" and alt="" attributes
    • if no title or alt is found, the Content Image name is used as Content name, eg. "SHOP-new_at_shopi_tile"
  • you may tag the content, but set it as not "tracked" automatically upon trackPageView() call
    - this can be used i.e. for carousel banner images on the page, so that the carousel script will trigger a method to track a banner when it's displayed.
    <div data-trackcontent data-noautotrack id="sample">
    <div class="piwik-trackcontent piwik-noautotrack" id="sample">
    • maybe we could automatically detect when such element becomes visible, and send the Impression event automatically
  • Tracking the impressions
  • One page typically will have several banners. Once the page is loaded, we check all tagged banners in the DOM,
  • (check whether these banners are displayed on the page - in case a carousel of ad, we want to track impressions of ads that are not hidden /display:none / visibility / height > 10 px / etc.)
  • Piwik.js on page load, when trackPageView() is executed, will create an array of Banner impressions events.
    - the trackPageview() will send only impressions for banners that are tracked automatically
  • Performance:
    - These impressions are sent at once along with the page view and/or any other event.
    - For a given banner on a given page, we should record the impression at most once (in case banner disappears and re-appears).
    - if it's too complex to bundle as one request, then it's Okay to do two http requests when Content pieces are in the page.
  • Note: if the banners on the page change (eg. using Ajax) then user must tell Piwik to re-scan the page to look for banners.
    • For this we can add piwik.js function trackContentPieces() that will let users re-scan the page for Content pieces when DOM has changed.
    • maybe we ask user to call trackContentPieces() to enable the feature?
  • Tracking the clicks
  • goal is to detect URL from href="" or onclick="" or other attributes.
  • How tracking clicks work: there are several options
    - user can decide to manually setup the proper redirect URL via piwik.php?rec=1&idsite=1&clickurl={$URL_HERE}&....
    - and/or maybe we can replace the href="" directly within the DOM so right click, middle click, shift click are also tracked
    • note: with this solution if Piwik http service is down then the website would be partly broken.
    • we should make sure the redirect still works when the mysql server is down
      - and/or maybe we can hook on the click event on the banner/ad element (and all its children?), then fetch the URL, and redirect this URL via piwik.php.
    • is there a valid JS technique to do this?
    • does it work in all modern browsers
    • does it work on mobile
    • Note: when banner links to external websites, for performance, do not trigger the outlink event as it can be tracked during the redirect
  • note: as a user, I see that piwik.php redirects is the default "click tracking" solution, but I want to be able to disable this piwik.php redirect and instead use the link tracking 500ms solution.
  • Reporting
  • New report: Actions > Content
    - Reports performance data by Banner name: Impressions, Clicks, CTR
    - Also reports the Overview with metrics value over all banners: Total banner impressions, Total banner clicks, Average CTR
    - possibility to display the banner images in the report (via toggle option)
    • how do manage standard IAB sizes to make the report look good
  • many existing benefits of using the Piwik platform
    - the Banner report can be segmented by any custom segment
    - historical data explorer and trends (row evolution)
    - Get alerted whenever Banners are very successful or a failure, with monthly or weekly Custom Alerts.
    - Reports can be scheduled by Email, download as PDF reports.... and in Piwik Mobile!
  • we will even be able to report accurate banner stats, ie. daily unique impressions and daily unique clicks
    - assuming we use custom events, eg. trackEvent(category = "banner", action ="impression", name = "SHOP Lunch box img4", value = $ad_visibility)

Sample banner code

We need to add "data-trackcontent" attribute to identify the banner and "data-name" to identify the banner name:

<div data-trackcontent data-name="Content name" class="subc">
<a data-trackclick title="Sample Banner" href="https://www.shop.us/grocery-items/new-at-shop/">
<img src="https://www.shop.us/fileadmin/Homepage/Bottom_Pod/SHOP-new_at_shop_tile.jpg" width="182" height="174" alt="">
</a>
</div>

Sample mockup

content-tracking

Docs & FAQ

@mattab
Copy link
Member Author

mattab commented May 30, 2014

Tracking banner ads impressions was discussed in this forum post

@mattab mattab added this to the 2.x - The Great Piwik 2.x Backlog milestone Jul 8, 2014
@hpvd
Copy link

hpvd commented Jul 10, 2014

maybe there is a intersection with usage possibilities of event tracking?
e.g.
if there are some tabs on your website you could define the usage of them as an event "jump to tab X" but of course the tab name (link) is also a piece of content...

-> what should the user do: implement both for the same thing? (i think this would be the worst way)
-> or could these functions be merged somehow?
=> hmm don't know...what do you think?

@mattab mattab added Major and removed c: Core labels Aug 3, 2014
@mattab mattab modified the milestones: Short term, Piwik 2.6.0 Aug 20, 2014
@mattab
Copy link
Member Author

mattab commented Aug 20, 2014

Ticket description has been updated with the latest version of the specs & requirements. Please comment if you have any feedback or idea!

@tsteur tsteur self-assigned this Aug 21, 2014
tsteur added a commit that referenced this issue Aug 21, 2014
tsteur added a commit that referenced this issue Aug 21, 2014
tsteur added a commit that referenced this issue Aug 21, 2014
tsteur added a commit that referenced this issue Aug 21, 2014
tsteur added a commit that referenced this issue Aug 22, 2014
tsteur added a commit that referenced this issue Aug 22, 2014
tsteur added a commit that referenced this issue Aug 22, 2014
tsteur added a commit that referenced this issue Aug 23, 2014
@hpvd
Copy link

hpvd commented Aug 25, 2014

hmm maybe you could have a look again on this comment
#4996 (comment)
and a give little more explanation of the differentiation of event tracking and content tracking? Isn't content tracking a part of event-tracking? Especially the things mentioned in #4996 (comment)
"tracking of scrolling etc" looks for me like an event: the user reaches 25% percent of the site, 50%... or the bottom (100%)
but also seeing and clicking a banner is an event...
giving it more detail:
maybe a more universal approach to reach the goals described in this ticket could be to offer the possibilities for perfect cross-linking of existing
event-tracking+
goal-tracking+
funnel-analysis?
only substitute an "event" by a "site visit" you could use the same way for a second type of analysis...
and the other way around: also other types of events would like to see this possibilities of analysis describe in this ticket...
sorry for bothering but i would really like to understand this!!

@tsteur
Copy link
Member

tsteur commented Aug 25, 2014

@mattab Don't think how far down a user scrolls is related to this issue. Such things need to be handled in a separate issue.

@hpvd You would use content-tracking for instance when displaying ads on a website. An ad can be for instance an image / banner. Different ads might be displayed on one page depending on the visitors but can be also always the same or there can be none ads sometimes. On some pages the shown ads even change after a certain time or event such as a click. You want to know how often a specific ad was displayed and how often it was clicked. You can not really answer this question with events.

The simple fact that a banner is shown on a page is not really an event I think. You'd probably end up having already like 10 events per page just for content-tracking. I haven't thought in detail about implementation yet but it will be probably a cross-link of content-tracking and event-tracking - indirectly maybe also goal tracking.

Is it maybe a bit clearer?

@mattab
Copy link
Member Author

mattab commented Aug 25, 2014

Maybe not MVP, but a good idea:

  • Allow to create a Goal that is triggered when Content Piece is Clicked. This would allow to see conversion rates to Goals, and referrer attribution of particular Clicks events / contents. This seems a good move to make the most of this interesting content measurement data.

@hpvd
Copy link

hpvd commented Aug 25, 2014

thanks for the explanations. It's getting a little clearer.
Especially when dealing with different banners which are not always shown.
(to get it right: the showing of banner was not considered as an event only the click of a a user triggers an event of type "user clicks on banner")

My general idea was not to have that many different things to track

only events (maybe of different types??) and sites

and using for everything the same statistic processes/types of analyses.
Just to simplify and streamline not only the program code but also the learning curve of the users:

  • everything works in the same way and
  • you have for everything the same analyses/statistics available

mattab pushed a commit that referenced this issue Aug 25, 2014
tsteur added a commit to matomo-org/developer-documentation that referenced this issue Sep 19, 2014
tsteur added a commit that referenced this issue Sep 19, 2014
…stalled. When replacing the initial link urls link tracking might not be installed yet but enabled (will be installed on load event). When a click is happening on a content block we still need to use linkTrackingInstalled since then the credirect/tracking request is actually happening and we need to know whether outlink/download will track it or whether we have to do it separately. Make sure to call enableLinkTracking before trackContentImpressions although there should be no huge difference as both will be delayed until ready/load event anyway
@tsteur
Copy link
Member

tsteur commented Sep 19, 2014

There is a bunch of things for V2: https://github.com/piwik/piwik/blob/master/misc/internal-docs/content-tracking.md#v2

Shall we create tickets for each one? Think that would be better to let them schedule easily

tsteur added a commit that referenced this issue Sep 19, 2014
…yet as they have to be returned in Live API which will be v2
tsteur added a commit that referenced this issue Sep 19, 2014
…r but returns different order or so on travis and I cannot fix it
@mattab
Copy link
Member Author

mattab commented Sep 20, 2014

+1 to create an issue for each idea you think we should work on in next
2 years!

maybe we also create a master ticket "Content Tracking improvements"?
we could put any random idea there as well as each Contents plugin issue
could refs this one.

@tsteur
Copy link
Member

tsteur commented Sep 22, 2014

Added some docs to JS tracker http://developer.piwik.org/api-reference/tracking-javascript#content-tracking, Tracking API http://developer.piwik.org/api-reference/tracking-api, a detailed guide http://developer.piwik.org/guides/content-tracking and a simple / short user guide (not published yet). Feel free to review @mattab

@tsteur
Copy link
Member

tsteur commented Sep 22, 2014

I'm not a huge fan of master tickets. It's like adding TODOs in code or writing down parts that need to be refactored on a page in a wiki. They usually never get done and it is like putting something into a trash. Small, specific issues can be easier prioritized and worked on, discussions are always only about one issue and so on.

I'd rather use the same label for all issues to get a summary as an "Epic" feature is missing in Github Issues.

@tsteur
Copy link
Member

tsteur commented Sep 22, 2014

FYI: Created #6265, #6266, #6267, #6268, #6269, #6270, #6271, #6272 .

@tsteur
Copy link
Member

tsteur commented Sep 22, 2014

I'd say the only missing thing is to make the UI test show any data but I don't get it to work. It looks like the fixture is executed and the entries seem to be in the log_link_visit_action table but for some reason it seems not to archive any data when generating the OmniFixture.sql. @diosmosis can you see any problem with this fixture? https://github.com/piwik/piwik/blob/master/plugins/Contents/tests/Fixtures/TwoVisitsWithContents.php

Do I maybe have to use the LocalTracker or so?

@mattab mattab modified the milestones: Piwik 2.8.0, Piwik 2.7.0 Sep 24, 2014
tsteur added a commit that referenced this issue Sep 30, 2014
@a4tunado
Copy link

a4tunado commented Oct 4, 2014

Hey! Just tested content interaction and it looks very promising!

I've experienced 'click' request cancellation problem (see attachement).
Probably this is because of timing issue. Browser gets link content faster than send track request. I've googled an article which suggests to listen 'mousedown' events instead of 'click' http://www.cardinalpath.com/experiment-onclick-vs-onmousedown-event-tracking-in-google-analytics

However it looks more like workaround but not a solution for the problem. Is there any way to wait until track request is sent?

interaction png

@mattab
Copy link
Member Author

mattab commented Oct 8, 2014

@diosmosis maybe you can assist @tsteur and help him get some content tracking data into the UI tests fixture? this is the last item left before this ticket can be closed. Thx

@tsteur
Copy link
Member

tsteur commented Oct 12, 2014

@diosmosis it does insert the content tracking fixture when building the omnifixture sql but for some reason it seems to not archive the data for content tracking and I don't understand why. Everything is looking good to me in log_ tables but the archives for content tracking contain empty datatables. Maybe you have had this problem before?

It also shows a blank table in the screenshot test but should actually show some data. The system tests on the other side work with the same fixture

@mattab mattab modified the milestones: Piwik 2.9.0, Piwik 2.8.0 Oct 13, 2014
tsteur added a commit that referenced this issue Oct 13, 2014
…is used.

Delay first content tracking request a bit to make kinda sure a possible
previous pageview request is already executed. If there is a new visitor
and there are 2 tracking requests at nearly same time (eg trackPageView
and trackContentImpression) 2 visits will be created as both visitors
are basically at the same time. This is only a workaround and it this
problem might still occur. Also delay a link earlier in case an
interaction is happening to make sure the browser waits for the
interaction to be tracked.
@diosmosis
Copy link
Member

@tsteur Sorry, missed this comment. Can you tell me where the UI tests for contents are (if any)?

@tsteur
Copy link
Member

tsteur commented Oct 17, 2014

tsteur added a commit that referenced this issue Oct 19, 2014
@tsteur tsteur closed this as completed Oct 20, 2014
@mattab
Copy link
Member Author

mattab commented Oct 21, 2014

Beautiful & Epic Work on Content Tracking!

To all users: enjoy Content Tracking and keep the feedback coming so we can make this feature even more useful in the future!

@mattab
Copy link
Member Author

mattab commented Dec 22, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: Platform For Matomo platform changes that aren't impacting any of our APIs but improve the core itself. Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical.
Projects
None yet
Development

No branches or pull requests

5 participants