Closed warrenchristian1telus closed 4 months ago
@warrenchristian1telus could you help us confirm estimate for this 2-3 points?
That sounds reasonable @Stella-Archer. Maybe 3 points as it involves some coordination with GTX. From previous experience, I'd say it'll take 2-3 weeks to fully implement once we have the code in place. I'm not sure about the code implementation, but expect one of the devs could handle it within a few minutes (not counting deployment time). Should just have to copy-paste the script above.
@warrenchristian1telus provide details so developers can implement the config in the code base
@Stella-Archer the JavaScript code required by the developers is in the first post above. This will need to be placed in a location where it will load on every page. Or at least every page that should be tracked.
The correct environment variable (SNOWPLOW_COLLECTOR) must also be set to match the desired environment as detailed above. We will need to setup dev first, then once completed/approved by GTX team, we can proceed with production implementation and verification.
Currently implemented the script locally. Need help for setting the env variable on openshift. Draft PR: https://github.com/bcgov/digital-journeys/pull/1735
Ready for review again.
I've verified that the dev site is now sending requests to spm.apps.gov.bc.ca as expected. I've notified Dan at GTX to complete the dashboard integration. Once everything is ready/verified we should be able to migrate through to production.
@jerry-ey I received a response from Dan:
"The base tracker is working, but there are some fixes we'll likely want to make to handle Single Page Web App issues."
He would like to set up a quick call to discuss. I'll add you to the email chain so we can figure out a good time.
Thanks, received the email. Will discuss with Dan on the call once he sets up the meeting.
The code is deployed to TEST and merged to main branch. Waiting for the call setup from Dan, haven't received from him for meeting schedule.
Jerry meeting with Warren and Dan to discuss the next steps
Had the meeting with Dan and Warren. There are 2 issue we need to resolve: I'll put "3" for estimation.
Bug: duplicate call at beginning when page load at first time.
Enhancement: add 'refreshLinkClickTracking' , then snowplow will know user is clinking on the "link". can use gov page to know what is correct behaviour. Ref: https://docs.snowplow.io/docs/collecting-data/collecting-from-own-applications/javascript-trackers/web-tracker/tracking-events/link-click/#refresh-link-click-tracking
Snowplow chrome extension for better debugging: https://chromewebstore.google.com/detail/snowplow-inspector/maplkdomeamdlngconidoefjpogkmljm
Dan also mentioned that GTX offers a free workshop to discuss and cost more advanced tracking opportunities, if we are interested at some point. @Stella-Archer @Abuchana @fazil-ey
Thanks @jerry-ey
@warrenchristian1telus FYI, The two issues from Dan are fixed and deployed to DEV and TEST.
Great - thank you @jerry-ey
I'll run this by Dan and see if we can move forward with production next week.
@jerry-ey Just a thought here, but I was wondering if it may be helpful to get more relevant titles into the pages. Rather than "Digital Journeys", we could have "Drafts: Telework" or something similar. This would likely make it much easier to separate and identify traffic in the resulting reports. Maybe there's a way we could use what's displayed to the user for the page title in the
I don't experience the duplicate issue, sent email to Dan to get more info.
I noticed one other minor issue. It looks like the AppID isn't being set, can you add this to the code where the object is firs appId: 'Snowplow_standalone_PSA', I think the whole thing will likely look something like: var collector = 'spm.apps.gov.bc.ca'; window. snowplow ('newTracker', 'rt', collector, ( appId: 'Snowplow_standalone_PSA', cookieLifetime: 86400 * 548, platform: 'web', post: true, forceSecureTracker: true, contexts: ( webPage: true, performanceTiming: true }) : Here are the steps to reproduce the double call: 1) Visit https://digital-journeys-dev.apps.silver.devops.gov.bc.ca/ I am redirected to " Log in to Digital Journeys with". No Snowplow call yet. (Not sure if you want one here, but you could add one if you want to see how many people hit the 2) Login via IDIR I am redirected to httos://lozon7.rov.bc.ca (which also doesn't have Snowolow trackine. but the production version does'
@warrenchristian1telus The new fix is up to DEV and TEST.
I have tested on TEST. Once DEV is up, please let Dan know to test. Thanks.
Thank you @jerry-ey. Dev is back online, and I have notified Dan to verify everything looks good on his end.
It's been a week and we didn't get back from Dan. I sent another email to follow up again.
The client test has passed. And we did deploy to production with correct url. Just sent the email to ask for the next step.
Warren to reach out to Dan about access to the dashboard for Stella and team.
@Stella-Archer will ask GDX service desk /Dan P about access to viewing dashboard
Naming Convention on URLS/IDs open new ticket for exploring page names form names
other domains? Key cloak, API domain BPM / cammunda? - Explore - Files/documents
To implement GTX / Snowplow Analytics on the PSA Analytics Dashboard:
https://intranet.qa.gov.bc.ca/analytics/psa-analytics
We will need to first implement the test script and have GTX validate it. This can be done in the dev namespace only, although it wouldn't hurt anything if it goes to test or prod.
We have used an environment variable in other projects to set the main Snowplow URL for dev or prod.
Dev:
SNOWPLOW_COLLECTOR=spm.apps.gov.bc.ca
Prod:
SNOWPLOW_COLLECTOR=spt.apps.gov.bc.ca
JavaScript code that needs to be implemented (preferably at the end of HTML). Note that the SNOWPLOW_COLLECTOR variable will need to be replaced / injected.
<script> // <!-- Snowplow starts plowing - Standalone vE.2.14.0 --> var collector = '{{ env('SNOWPLOW_COLLECTOR') }}'; if(collector != null && collector != ''){ ;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[]; p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments) };p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1; n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","https://www2.gov.bc.ca/StaticWebResources/static/sp/sp-2-14-0.js","snowplow")); window.snowplow('newTracker','rt',collector, { appId: 'Snowplow_standalone_PSA', cookieLifetime: 86400 * 548, platform: 'web', post: true, forceSecureTracker: true, contexts: { webPage: true, performanceTiming: true } }); window.snowplow('enableActivityTracking', 30, 30); // Ping every 30 seconds after 30 seconds window.snowplow('enableLinkClickTracking'); window.snowplow('trackPageView'); } // <!-- Snowplow stops plowing –> </script>
NOTE: Dan will test this ticket.