fixes KNO-392
flag = none
the org type that was introduced in g/236404 and g/236535 is now
submitted to GA pageviews as a new dimension (4). These are the current
org types and their account counts, which you can get from Salesforce:
- Corporate (1206)
- Further Education (359)
- Government (29)
- Higher Ed (2468)
- K12 (3807)
- Other (15)
- RTO/Training (86)
- RTO (1)
- Internal Use Only (1)
- Regional Training Provider (1)
- Training Org (1)
|
| TEST PLAN
|
- make sure you have GA enabled if you don't already:
Setting.set('google_analytics_key', 'foo')
- visit any page, then look for the GA snippet[1] and verify that
"dimension4" is set to null
- now mark your account as "K12":
Account.default.external_integration_keys.create!(
key_type: 'salesforce_org_type',
key_value: 'K12'
)
- reload the page and verify that "dimension4" is set to "K12" in the GA
snippet
- unmark the account and verify the dimension is back to null:
Account.default.external_integration_keys.where(
key_type: 'salesforce_org_type'
).destroy_all
[1]: do "view source" in browser then jump to the term "window.ga", or
you can use this query in the console and inspect the element:
Array.prototype.find.call(
document.head.querySelectorAll('script'),
x => x.innerHTML.match(/window.ga/)
)
Change-Id: I505bf1ee2a8347a21d691e2fa4ef04cb07c9a48e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/238656
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Davis Hyer <dhyer@instructure.com>
QA-Review: Davis Hyer <dhyer@instructure.com>
Product-Review: Davis Hyer <dhyer@instructure.com>
fixes KNO-391
flag = none
Page views sent to GA are now identified with a value that is unique to
the user but is also not their Canvas ID (to preserve anonymity.) To
avoid further bloat in the User model, I chose to compute this id from
the user id directly by means of a digest as opposed to introducing
another field like User#lti_id.
---------
\ TEST PLAN /
/ \
\-/---\-/
- without being logged in, visit canvas and inspect the page source for
the GA snippet:
* verify "userId"[1] is not being set
- now log in and inspect the source again:
* verify the "userId" is being set to a value that is _not_ the Canvas
user id
* reload the page and verify the value does not change
- (optional) log in as a different user and verify the userId value is
different from the one given to the first user
[1]: https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#userId
Change-Id: Iaec342c3631e689d754ab35663f4b9c6ac397257
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/233416
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Davis Hyer <dhyer@instructure.com>
QA-Review: Davis Hyer <dhyer@instructure.com>
Product-Review: Davis Hyer <dhyer@instructure.com>
fixes KNO-355
flag = none
this is an attempt at making it possible to segment the stats available
on GA by metrics relevant to product... the goal is to be able to tell
which flows are popular among students versus those among teachers, for
example
we now supply every pageview hit with 3 types of additional information:
1. enrollments (student? teacher? observer?)
2. admin status (admin? site admin?)
3. masquerading?
this information is tracked in "custom dimensions"[1] and the submission
is still anonymous; we're not tracking userId
. . . . .
\ TEST PLAN /
---- ----
- create yourself a google analytics account, because if not now, when?
this is your chance
- inside GA, create "Custom Dimensions" for each of the dimensions[2]
implemented in this patch:
1. Enrollments
2. Admin
3. Masquerading
- use a Rails console to set your tracker id:
Setting.set('google_analytics_key', TRACKER_ID)
- now browse around Canvas and keep an eye on the GA dashboard; you
should see points tracked after some time (could take up to an hour
really...) with the dimensions populated
[1]: https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#customs
[2]: from User#user_roles - https://gerrit.instructure.com/plugins/gitiles/canvas-lms/+/refs/heads/master/app/models/user.rb#2877
Change-Id: I1d797e6c500d3d60da36da3b50339bab649e57de
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/230360
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>