Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 249256 Details for
Bug 454478
set user id with GA property instead of custom dimension
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch (note: init not working)
patch.txt (text/plain), 5.17 KB, created by
Grant Gayed
on 2014-12-08 13:23:22 EST
(
hide
)
Description:
patch (note: init not working)
Filename:
MIME Type:
Creator:
Grant Gayed
Created:
2014-12-08 13:23:22 EST
Size:
5.17 KB
patch
obsolete
>diff --git a/bundles/org.eclipse.orion.client.core/web/orion/metrics.js b/bundles/org.eclipse.orion.client.core/web/orion/metrics.js >index f40637b..6801bd3 100644 >--- a/bundles/org.eclipse.orion.client.core/web/orion/metrics.js >+++ b/bundles/org.eclipse.orion.client.core/web/orion/metrics.js >@@ -15,7 +15,6 @@ > var queue = []; > > var init = function(serviceRegistry, args) { >- var promise = new Deferred(); > var refs = serviceRegistry.getServiceReferences("orion.analytics.google"); //$NON-NLS-0$ > if (refs.length) { > var ref = refs[0]; >@@ -28,24 +27,32 @@ > return; > } > >- (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ >- (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), >- m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) >- })(window,document,'script','//www.google-analytics.com/analytics.js',GA_ID); >+ var userService = serviceRegistry.getService("orion.core.user"); //$NON-NLS-0$ >+ var authServices = serviceRegistry.getServiceReferences("orion.core.auth"); //$NON-NLS-0$ >+ for (var i = 0; i < authServices.length; i++) { >+ var authService = serviceRegistry.getService(authServices[i]); >+ authService.getUser().then(function(jsonData) { >+ userService.getUserInfo(jsonData.Location).then(function(accountData) { >+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ >+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), >+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) >+ })(window,document,'script','//www.google-analytics.com/analytics.js',GA_ID); > >- args = args || {}; >- if (result.siteSpeedSampleRate) { >- args.siteSpeedSampleRate = result.siteSpeedSampleRate; >+ args = args || {}; >+ if (result.siteSpeedSampleRate) { >+ args.siteSpeedSampleRate = result.siteSpeedSampleRate; >+ } >+ window[GA_ID]("create", result.tid, args); //$NON-NLS-0$ >+ window[GA_ID]("send", "pageview"); //$NON-NLS-1$ //$NON-NLS-0$ >+ window[GA_ID]("set", "dimension2", window.btoa(accountData.UserName)); //$NON-NLS-1$ //$NON-NLS-0$ >+ >+ queue.forEach(function(current) { >+ window[GA_ID](current.command, current.arg0, current.arg1, current.arg2, current.arg3, current.arg4); //$NON-NLS-0$ >+ }); >+ queue = null; /* no longer needed */ >+ }); >+ }); > } >- window[GA_ID]("create", result.tid, args); //$NON-NLS-0$ >- window[GA_ID]("send", "pageview"); //$NON-NLS-1$ //$NON-NLS-0$ >- >- queue.forEach(function(current) { >- window[GA_ID](current.command, current.arg0, current.arg1, current.arg2, current.arg3, current.arg4); //$NON-NLS-0$ >- }); >- queue = null; /* no longer needed */ >- >- promise.resolve(); > } > ); > } >@@ -53,11 +60,11 @@ > if (!(service && service.init)) { > queue = null; /* not tracking */ > } >- return promise; > }; > > function logEvent(category, action, label, value) { > if (window[GA_ID]) { >+window.console.log(category + "..." + action + "..." + label + "..." + value) > window[GA_ID]("send", "event", category, action, label, value); //$NON-NLS-1$ //$NON-NLS-0$ > } else { > if (queue) { >@@ -87,21 +94,10 @@ > } > } > >- function setDimension(dimensionId, value) { >- if (window[GA_ID]) { >- window[GA_ID]("set", dimensionId, value); //$NON-NLS-0$ >- } else { >- if (queue) { >- queue.push({command: "set", arg0: dimensionId, arg1: value}); //$NON-NLS-0$ >- } >- } >- } >- > return { > init: init, > logEvent: logEvent, > logPageLoadTiming: logPageLoadTiming, >- logTiming: logTiming, >- setDimension: setDimension >+ logTiming: logTiming > }; > }); >diff --git a/bundles/org.eclipse.orion.client.ui/web/orion/globalCommands.js b/bundles/org.eclipse.orion.client.ui/web/orion/globalCommands.js >index 03adc54..5e2d560 100644 >--- a/bundles/org.eclipse.orion.client.ui/web/orion/globalCommands.js >+++ b/bundles/org.eclipse.orion.client.ui/web/orion/globalCommands.js >@@ -556,21 +556,6 @@ > * @param {Boolean} closeSplitter true to make the splitter's initial state "closed". > */ > function generateBanner(parentId, serviceRegistry, commandRegistry, prefsService, searcher, handler, /* optional */ editor, closeSplitter, fileClient) { >- mMetrics.init(serviceRegistry).then( >- function() { >- var userService = serviceRegistry.getService("orion.core.user"); //$NON-NLS-0$ >- var authServices = serviceRegistry.getServiceReferences("orion.core.auth"); //$NON-NLS-0$ >- for (var i = 0; i < authServices.length; i++) { >- var authService = serviceRegistry.getService(authServices[i]); >- authService.getUser().then(function(jsonData){ >- userService.getUserInfo(jsonData.Location).then(function(accountData) { >- mMetrics.setDimension("dimension2", window.btoa(accountData.UserName)); //$NON-NLS-0$ >- }); >- }); >- } >- } >- ); >- > new mThemePreferences.ThemePreferences(prefsService, new mThemeData.ThemeData()).apply(); > > var parent = lib.node(parentId);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 454478
: 249256