summaryrefslogtreecommitdiffstats
path: root/chrome/browser/resources/ntp/apps.js
diff options
context:
space:
mode:
authorjstritar@chromium.org <jstritar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-12 21:59:48 +0000
committerjstritar@chromium.org <jstritar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-12 21:59:48 +0000
commitfd131723b6ff17cc408920b22f8de08575dfc91d (patch)
tree67fb4ced778be29e8cbde52ef6e12c9dc5ada89d /chrome/browser/resources/ntp/apps.js
parent4790db572ffcb4f10ec64abaa77696e8ee6ace03 (diff)
downloadchromium_src-fd131723b6ff17cc408920b22f8de08575dfc91d.zip
chromium_src-fd131723b6ff17cc408920b22f8de08575dfc91d.tar.gz
chromium_src-fd131723b6ff17cc408920b22f8de08575dfc91d.tar.bz2
Add a histogram for tracking web store promo
Creates an enumeration histogram called Extensions.AppsPromo with the following buckets: 0: launched an application from the promo 1: launched the web store from the promo 2: manually closed the promo (and uninstalled the applications) 3: promo expired BUG=61017 TEST= Review URL: http://codereview.chromium.org/4708002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66006 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/resources/ntp/apps.js')
-rw-r--r--chrome/browser/resources/ntp/apps.js18
1 files changed, 17 insertions, 1 deletions
diff --git a/chrome/browser/resources/ntp/apps.js b/chrome/browser/resources/ntp/apps.js
index 81d7eb0..7069231 100644
--- a/chrome/browser/resources/ntp/apps.js
+++ b/chrome/browser/resources/ntp/apps.js
@@ -6,19 +6,28 @@ var MAX_APPS_PER_ROW = [];
MAX_APPS_PER_ROW[LayoutMode.SMALL] = 4;
MAX_APPS_PER_ROW[LayoutMode.NORMAL] = 6;
+// The URL prefix used in the app link 'ping' attributes.
+var PING_APP_LAUNCH_PREFIX = 'record-app-launch';
+
+// The URL prefix used in the webstore link 'ping' attributes.
+var PING_WEBSTORE_LAUNCH_PREFIX = 'record-webstore-launch';
+
function getAppsCallback(data) {
logEvent('received apps');
var appsSection = $('apps');
var appsSectionContent = $('apps-content');
var appsMiniview = appsSection.getElementsByClassName('miniview')[0];
var appsPromo = $('apps-promo');
+ var appsPromoPing = PING_WEBSTORE_LAUNCH_PREFIX + '+' + data.showPromo;
var webStoreEntry;
appsMiniview.textContent = '';
appsSectionContent.textContent = '';
+ apps.showPromo = data.showPromo;
+
data.apps.sort(function(a,b) {
- return a.app_launch_index - b.app_launch_index
+ return a.app_launch_index - b.app_launch_index;
});
clearClosedMenu(apps.menu);
@@ -31,6 +40,7 @@ function getAppsCallback(data) {
});
webStoreEntry = apps.createWebStoreElement();
+ webStoreEntry.querySelector('a').setAttribute('ping', appsPromoPing);
appsSectionContent.appendChild(webStoreEntry);
data.apps.slice(0, MAX_MINIVIEW_ITEMS).forEach(function(app) {
@@ -49,6 +59,7 @@ function getAppsCallback(data) {
document.documentElement.classList.add('apps-promo-visible');
else
document.documentElement.classList.remove('apps-promo-visible');
+ $('apps-promo-link').setAttribute('ping', appsPromoPing);
maybeDoneLoading();
if (data.apps.length > 0 && isDoneLoading()) {
@@ -227,11 +238,14 @@ var apps = (function() {
menu: $('apps-menu'),
+ showPromo: false,
+
createElement: function(app) {
var div = createElement(app);
var a = div.firstChild;
a.onclick = handleClick;
+ a.setAttribute('ping', PING_APP_LAUNCH_PREFIX + '+' + this.showPromo);
a.style.backgroundImage = url(app['icon_big']);
if (hashParams['app-id'] == app['id']) {
div.setAttribute('new', 'new');
@@ -271,6 +285,7 @@ var apps = (function() {
a.textContent = app['name'];
a.href = app['launch_url'];
a.onclick = handleClick;
+ a.setAttribute('ping', PING_APP_LAUNCH_PREFIX + '+' + this.showPromo);
a.style.backgroundImage = url(app['icon_small']);
a.className = 'item';
span.appendChild(a);
@@ -286,6 +301,7 @@ var apps = (function() {
a.textContent = app['name'];
a.href = app['launch_url'];
a.onclick = handleClick;
+ a.setAttribute('ping', PING_APP_LAUNCH_PREFIX + '+' + this.showPromo);
a.style.backgroundImage = url(app['icon_small']);
a.className = 'item';
return a;