Implement user_id and pass it in marketo submission
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.cookieand see thatuser_iddoes not exist - Accept either all or performance cookies and do the same as above, this time ensuring that
user_idis now present
- Before accepting any cookies open dev tools, log
- 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:
- Click on the "SFDC Custom Fields" tab and see that
Google Analytics User IDhas you user id as a value:
Issue / Card
Fixes https://warthogs.atlassian.net/browse/WD-14942
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
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.
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
Hi @mtruj013 @laszlokajtar ,
I confirm that all the issues are solved and test went through.
Thanks!
@mtruj013 @eabashidze thanks a lot for figuring it out!
@mtruj013 @eabashidze i've had multiple sessions now where user_id wasn't generated for me. is this an exception?
@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 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 @akbarkz thank you!