Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Merge pull request #2786 from mozilla-services/2143-direct-owner
Browse files Browse the repository at this point in the history
extended direct-view event with ownership
  • Loading branch information
ianb authored May 2, 2017
2 parents e0509e9 + 0cc662c commit 64adacc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
6 changes: 4 additions & 2 deletions docs/METRICS.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ These are events that an add-on user can encounter on a shot they own
32. [x] Click Feedback/mailto button `start-feedback/footer`
31. [x] Click on clip `web/goto-clip/content`
32. [x] Click the download button `web/download/navbar`
33. [x] Visit an image directly, when the image isn't embedded directly in a Screenshots shot page, `web/visit/direct-view-owner`
34. [x] View an image directly, when the image is being shown as part of a Facebook/Twitter style preview (the og:image or twitter:image), `web/visit/direct-view-embedded-owner`

#### Shot Index (My Shots)

Expand All @@ -223,8 +225,8 @@ These are events that an add-on user can encounter on a shot they own
#### Non-owner web visit

1. [x] Visit the page, `web/visit/non-owner`
2. [x] Visit an image directly, when the image isn't embedded directly in a Screenshots shot page, `web/visit/direct-view`
3. [x] View an image directly, when the image is being shown as part of a Facebook/Twitter style preview (the og:image or twitter:image), `web/visit/direct-view-embedded`
2. [x] Visit an image directly, when the image isn't embedded directly in a Screenshots shot page, `web/visit/direct-view-non-owner`
3. [x] View an image directly, when the image is being shown as part of a Facebook/Twitter style preview (the og:image or twitter:image), `web/visit/direct-view-embedded-non-owner`
2. [x] Click flag button `web/start-flag/navbar`
3. [x] Click Share (same as for owner, but with `share-non-owner` instead of `share-owner`, and `start-share-non-owner`)
4. [x] Visit original URL `web/goto-original-url/navbar`
Expand Down
4 changes: 3 additions & 1 deletion server/src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,8 @@ app.get("/images/:imageid", function(req, res) {
analytics = analytics.debug();
}
}
const view = embedded ? "direct-view-embedded" : "direct-view";
const el = view + (obj.ownerId === req.deviceId ? "-owner" : "-non-owner");
analytics.pageview({
dp: analyticsUrl,
dh: req.backend,
Expand All @@ -807,7 +809,7 @@ app.get("/images/:imageid", function(req, res) {
}).event({
ec: "web",
ea: "visit",
el: embedded ? "direct-view-embedded" : "direct-view"
el
}).send();
}
res.header("Content-Type", "image/png");
Expand Down
8 changes: 6 additions & 2 deletions server/src/servershot.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ class Shot extends AbstractShot {

Shot.getRawBytesForClip = function(uid) {
return db.select(
`SELECT images.url, images.contenttype
`SELECT images.url, images.contenttype, data.deviceid
FROM images
JOIN data ON images.shotid = data.id
WHERE images.id = $1
Expand All @@ -313,7 +313,11 @@ Shot.getRawBytesForClip = function(uid) {
if (!rows.length) {
return null;
}
return get(uid, rows[0].contenttype);
return get(uid, rows[0].contenttype)
.then(result => {
result.ownerId = rows[0].deviceid;
return result;
});
});
};

Expand Down

0 comments on commit 64adacc

Please sign in to comment.