GCTC-NTGC / gc-digital-talent

GC Digital Talent is the new recruitment platform for digital and tech jobs in the Government of Canada. // Talents numériques du GC est la nouvelle plateforme de recrutement pour les emplois numériques et technologiques au gouvernement du Canada.
https://talent.canada.ca
GNU Affero General Public License v3.0
20 stars 8 forks source link

🛠️ collect additional metrics in Azure App Insights #9375

Closed brindasasi closed 3 days ago

brindasasi commented 7 months ago

🛠️ Tooling

We would like to know how users arrived on our site, ie whether the user came from GC Jobs, Google, or anywhere else.

🙋‍♀️ Proposed Solution

Pass the value of the Referer header to Azure App insights.

I think it might be done like this? https://learn.microsoft.com/en-us/answers/questions/254833/url-referrer-in-app-insights

// This code needs to be adapted to javascript. This only needs to be done when the broswer refreshes. Do we record it like an "Event"?
string referrer = HttpContext.Current.Request.UrlReferrer.ToString();  
telemetry.Context.Properties.Add("Referrer", referrer);  

✅ Acceptance Criteria

A set of assumptions which, when tested, verify that the debt tooling was properly updated and remains functional.

brindasasi commented 6 months ago

do we have any decision on this ? @GCTC-NTGC/developers

brindasasi commented 6 months ago

as per the above linked doc

It isn't necessary to use the user's actual sign-in name. It only has to be an ID that is unique to that user. It must not include spaces or any of the characters ,;=|.

petertgiles commented 3 months ago

@gobyrne Is this something we could do? Should do?

brindasasi commented 1 month ago

@tristan-orourke I see this metric is already available in AppInsights. We might not need this. Here are the steps to see this report :

  1. open Application Insights on Azure
  2. Home -> TalentCloud -> Metrics
  3. Select Page Views Metrics , Aggregation drop down -> Sum
  4. Click Apply Splitting
  5. Split by -> refUri

image (10)

In the below screen shot see the entry from google.com

image (9)

tristan-orourke commented 1 month ago

https://talent-cloud.slack.com/archives/C0259G6KXJ6/p1723233611676579

tristan-orourke commented 3 weeks ago

I've looked at refUri, and I believe it tracks how a user moves from page to page within our app, but not where they came from before arriving at our app. Brinda has a draft PR which I'll try on Dev to see if it works differently.

petertgiles commented 3 weeks ago

I haven't spent too much time in App Insights but our app service HTTP logs do have Referrer available as well.

Image

brindasasi commented 4 days ago

We do have refuri already logged in. But I do see lot of undefined entries as well. Screenshot Image

Report dump Metrics.xlsx

brindasasi commented 4 days ago

The above is the last 90 days report. If we think adding another metric manually would help break down those undefined entries, I can go ahead with this PR to verify. Otherwise its a duplicate effort.

brindasasi commented 3 days ago

Btw, @tristan-orourke The first entry in @petertgiles's screenshot is actually from the gc jobs site. Look at the url in below screenshot of gc jobs Image

petertgiles commented 3 days ago

I was thinking about those undefineds. I think it makes sense that most hits don't have a referrer. That would cover anyone typing in the URL, launching it from a bookmark, or launching it from link in an email, right?

brindasasi commented 3 days ago

yeah .. I combed through them through the http logs. Looks like genuine ones and we are good with that. Will close this ticket and my pr as not needed anymore.