ubuntu.com icon indicating copy to clipboard operation
ubuntu.com copied to clipboard

Implement user_id and pass it in marketo submission

Open mtruj013 opened this issue 1 year ago • 8 comments

Done

  • Implemented “user_id” feature to send universally unique identifiers to Google Analytics as described here
  • Added functionality to pass value on form submission

QA

  • View the site locally in your web browser at: https://ubuntu-com-14440.demos.haus/ (or any page)
  • If you have not set cookie preferences:
    • Before accepting any cookies open dev tools, log document.cookie and see that user_id does not exist
    • Accept either all or performance cookies and do the same as above, this time ensuring that user_id is now present
  • Go to any form and fill it out (https://ubuntu-com-14440.demos.haus/ai#get-in-touch for example)
  • Go to the enrichment form on maketo: https://engage-sj.marketo.com/?munchkinId=066-EOV-335#/mktform/4198/overview/details -> "Lead enrichment details" -> "People"
  • Search for the email you used and the click on the ID link, eg: image
  • Click on the "SFDC Custom Fields" tab and see that Google Analytics User ID has you user id as a value: image

Issue / Card

Fixes https://warthogs.atlassian.net/browse/WD-14942

mtruj013 avatar Oct 21 '24 16:10 mtruj013

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 69.64%. Comparing base (6f5e37b) to head (7628818). Report is 44 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #14440      +/-   ##
==========================================
+ Coverage   69.58%   69.64%   +0.05%     
==========================================
  Files         120      120              
  Lines        3419     3419              
  Branches     1178     1174       -4     
==========================================
+ Hits         2379     2381       +2     
+ Misses       1015     1013       -2     
  Partials       25       25              

see 1 file with indirect coverage changes

codecov[bot] avatar Oct 21 '24 16:10 codecov[bot]

Hi team! I could not catch user_id in Marketo after testing. Here are the results: As the first step, I added the hidden field to marketo enrichment form, and set it as non-mandatory. On the website end, user_id does not become visible in document.cookies after cookies are accepted, only after I refresh it. Same for dataLayer, user_id becomes visible after accepting cookies + the refresh. When I navigate to the form (submitted 2 contact us forms), it's visible neither in data layer, nor in the payload. I can see user_id in the cookie part of the network tab (checking the submitting activity), but still not passed to mkto. Please advise on next steps.

eabashidze avatar Oct 23 '24 12:10 eabashidze

Thanks @eabashidze , I've pushed a fix for the cookie only being set after refresh, but I'm still trying to figure out why the id isn't being submitted even though I've added it to the enrichment payload. Will ping you once I have a fix

mtruj013 avatar Oct 23 '24 14:10 mtruj013

Hi @mtruj013 @laszlokajtar , I confirm that all the issues are solved and test went through. Thanks! Screenshot from 2024-10-24 14-01-57 Screenshot from 2024-10-24 13-58-31

eabashidze avatar Oct 24 '24 10:10 eabashidze

@mtruj013 @eabashidze thanks a lot for figuring it out!

laszlokajtar avatar Oct 24 '24 12:10 laszlokajtar

@mtruj013 @eabashidze i've had multiple sessions now where user_id wasn't generated for me. is this an exception?

laszlokajtar avatar Oct 24 '24 13:10 laszlokajtar

@mtruj013 @eabashidze also, in a new incognito session, while the user_id was in the cookies, it disappears or doesn't get pushed into the dataLayer on page reload for me

laszlokajtar avatar Oct 24 '24 13:10 laszlokajtar

@laszlokajtar I fixed the dataLayer not persisting but, I couldn't replicate any session wherein user_id wasn't generated on chrome or ff, incognito or otherwise. Please flag if you're still having this issue. I've tested on multiple pages and checked on marketo and everything seems to be working as expected

mtruj013 avatar Oct 30 '24 17:10 mtruj013

@mtruj013 @akbarkz thank you!

laszlokajtar avatar Oct 31 '24 11:10 laszlokajtar