department-of-veterans-affairs / notification-api

Notification API
MIT License
15 stars 8 forks source link

GA4 Migration: Build dynamic URL for open email tracking #1847

Closed MackHalliday closed 1 month ago

MackHalliday commented 2 months ago

User Story - Business Need

We need to construct a dynamic URL that contains information on notification emails being sent. This URL should be passed as an optional parameter into the HTMLEmailTemplate class within the send_email_to_provider method. The HTMLEmailTemplate class is located in the notification-utils repository. In an earlier user story, a dynamic URL variable was embedded in the notification email, and, when the variable is populated and the email is openned, a GET request will be made to our notification-api repo. This user story focuses exclusively on building and passing the dynamic GET URL to the HTMLEmailTemplate class.

FIX BUG created in #153. We need to update the new GET ga4/open-email-tracking to return an pixel to avoid the broken image icon in appearing in emails.

User Story(ies)

As a VA Notify Developer I want to build a dynamic URL that contains information on emails being sent So that the dynamic URL can eventually be use to execute a GET request through pixel tracking when the email is opened.

Additional Info and Resources

Engineering Checklist

Acceptance Criteria

QA Considerations

cris-oddball commented 2 months ago

Adding the QA Reviewed label, but the QA work on this ticket seems incomplete (based on the Utils ticket saying that the QA info will be on this ticket. We can discuss in Refinement or during the QA convo when the developer picks up the ticket.

mjones-oddball commented 1 month ago

Hey team! Please add your planning poker estimate with Zenhub @cris-oddball @EvanParish @k-macmillan @kalbfled @MackHalliday @mchlwellman

MackHalliday commented 1 month ago

Yesterday

Today

MackHalliday commented 1 month ago

Yesterday

Today

MackHalliday commented 1 month ago

Friday

Today

MackHalliday commented 1 month ago

Yesterday

Today

MackHalliday commented 1 month ago

Yesterday

Today

MackHalliday commented 1 month ago

Blocked Yesterday

Basically, GitHub Workflow tests do not run in a Docker Container. So when the tests hit the ga4/open-email-tracking endpoint, the image is under a different path than in a local env or the DEV env.

cris-oddball commented 1 month ago

QA PASSED

INFO 2024-07-18 18:16:50,781 /app/app/googleanalytics/ga4.py:33: b'campaign=hello_qa&campaign_id=37f1d6d2-1354-49bd-9600-2517e3fac79d&name=email_open&source=vanotify&medium=email&content=qatest/d44e841a-3d08-4f3d-9798-6e891cc4f585/5a395e3d-0d63-4c64-ba06-d919217058a1'

10.247.182.126 - - [18/Jul/2024:18:16:50 +0000] "GET /ga4/open-email-tracking?campaign=hello_qa&campaign_id=37f1d6d2-1354-49bd-9600-2517e3fac79d&name=email_open&source=vanotify&medium=email&content=qatest/d44e841a-3d08-4f3d-9798-6e891cc4f585/5a395e3d-0d63-4c64-ba06-d919217058a1 HTTP/1.1" 200 86 "-" "python-requests/2.32.3"

[2024-07-18 18:28:33,894: DEBUG/ForkPoolWorker-4] Generated Google Analytics 4 pixel URL: https://sandbox-api.va.gov/vanotify/ga4/open-email-tracking?campaign=12.07test&campaign_id=65a7f39d-76df-4c57-9592-339e467d7b25&name=email_open&source=vanotify&medium=email&content=VA%20Notify/d6aa2c68-a2d9-4437-ab19-3ae8eb202553/7ed4fea4-dcdc-45b2-95e6-d4af2a3cb412

Image is embedded in email (cached with Google here)

Screenshot 2024-07-18 at 12.33.26 PM.jpg

-[ ] Happy Path - email notification is sent and the email is opened, image blocking is OFF, expect that the route is hit, a pixel is embedded

The more that passes with testing, the more we are seeing that a broken image icon briefly appears and then disappears when the image is downloaded. Evan is checking APM and I will be testing with Dev tools in a browser. Seen more in Outlook and Gmail on Android than Gmail in Chrome.

Latency of route is very low:

image (45).png
cris-oddball commented 1 month ago

Holding open until Monday to remind me to deploy this to Prod.

cris-oddball commented 1 month ago

Deploying to Prod. Need to create a new ticket prior to closing.