-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MWPW-146528[MILO][MEP][ANALYTICS] Add attribute to content changed by Target for analytics and MWPW-152274 #2593
Conversation
Co-authored-by: Vivian A Goodrich <101133187+vgoodric@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
…tc. (#2608) * add preload * shorten if and and conditional chaining * run loop even if Target is off
} | ||
export function addMepHighlightAndTargetId(el, source) { | ||
let { manifestId, targetManifestId } = source.dataset; | ||
manifestId ??= source?.closest('[data-manifest-id]')?.dataset?.manifestId; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
??= is new for me. Never seen it used before =). Maybe consider that a lot of people are like me and also haven't seen it used and may be confused ;) I dunno, up to you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@denlight, I take your point about the Nullish coalescing assignment operator (I had to look up the name up again today when Chris suggested it ;)), but it is nice and concise and we've already used in a couple of other places in personalization.js so let's keep it. Thanks.
@@ -424,24 +403,39 @@ const addHash = (url, newHash) => { | |||
} | |||
}; | |||
|
|||
const setDataIdOnChildren = (sections, id, value) => { | |||
[...sections[0].children].forEach( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we know that sections[0] will always exist ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@denlight, @vivgoodrich, setDataIdOnChildren is only called within the updateFragDataProps function which is only called in the fragment.js init function. There is already a check for sections.length before the sections variable is passed into updateFragDataProps (fragment.js, line 102) so the current code is safe. I can come back to this in a future ticket, but I suggest we leave it as is tonight to avoid last second changes. Thanks.
…hen there is a disabled manifest (#2616) * add default execution order * unit test
@@ -424,24 +403,39 @@ const addHash = (url, newHash) => { | |||
} | |||
}; | |||
|
|||
const setDataIdOnChildren = (sections, id, value) => { | |||
[...sections[0].children].forEach( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[...sections[0].children].forEach( | |
if (!sections.length) return; | |
[...sections[0].children].forEach( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vivgoodrich, please see comment above.
Error merging 2593: MWPW-146528[MILO][MEP][ANALYTICS] Add attribute to content changed by Target for analytics and MWPW-152274 file is not defined |
* stage: MWPW-154998 [MEP][MILO] Manifests do not execute in the right order when there is a disabled manifest (adobecom#2632) mwpw-154965: Fetch federal stage content from hlx.page instead of stage.adobe.com (adobecom#2618) Correct error messages for duplicate files on the stage to main workflow (adobecom#2621) MWPW-153245 [merch][analytics] dispatch wcomp events, and let default lh (adobecom#2610) Revert "MWPW-146528[MILO][MEP][ANALYTICS] Add attribute to content changed by Target for analytics and MWPW-152274" (adobecom#2627) MWPW-128600 Locale Tool: Langstore points to langstore/en (adobecom#2615) Fix for errors in dynamically loaded scripts in test cases (adobecom#2619) MWPW-146528[MILO][MEP][ANALYTICS] Add attribute to content changed by Target for analytics and MWPW-152274 (adobecom#2593) Bootstrapper script for milo feds blocks (adobecom#2560) Revert "[MWPW-152968] mWeb - Passing ECID to Branch.io banner - Implementation" (adobecom#2612) MWPW-146743 Improve Article Header Performance (adobecom#2577) MWPW-153808: fix duplicate tax label (adobecom#2614) MWPW-154026: Long CTAs fall in the second line in merch card footer (adobecom#2565) Revert "[MWPW-154795] Style Feds Global-footer region picker drop-up variant (without hash)" (adobecom#2611) [AUTOMATED-PR] Update imslib.min.js dependency (adobecom#2605) [MWPW-154795] Style Feds Global-footer region picker drop-up variant (without hash) (adobecom#2599) MWPW-143053 [MEP] Request for New Personalization Tag - CC Paid (adobecom#2604) [MWPW-152674] [Gray Box] Desktop gnav not hidden when device view is open (adobecom#2597) MWPW-150566 - 🆕 Editorial-Card block (adobecom#2533) # Conflicts: # libs/deps/merch-card.js
* stage: [MWPW-153611] [Gray Box] environment aware links (adobecom#2622) MWPW-153580: Add Opt-In Feature for CaaS Badge Display (adobecom#2625) [MWPW-154335] [callout] Spacing issue encountered when the call-out section is added (adobecom#2628) MWPW-150557 - Split Marquee CLS issues on consuming sites (adobecom#2636) Mwpw 147034: Custom border color + badge/border color decoupling [merch card] (adobecom#2613) [MWPW-151517] - Remove condition for promobar hidden on mobile from gnav (adobecom#2538) MWPW-154998 [MEP][MILO] Manifests do not execute in the right order when there is a disabled manifest (adobecom#2632) mwpw-154965: Fetch federal stage content from hlx.page instead of stage.adobe.com (adobecom#2618) Correct error messages for duplicate files on the stage to main workflow (adobecom#2621) MWPW-153245 [merch][analytics] dispatch wcomp events, and let default lh (adobecom#2610) Revert "MWPW-146528[MILO][MEP][ANALYTICS] Add attribute to content changed by Target for analytics and MWPW-152274" (adobecom#2627) MWPW-128600 Locale Tool: Langstore points to langstore/en (adobecom#2615) Fix for errors in dynamically loaded scripts in test cases (adobecom#2619) MWPW-146528[MILO][MEP][ANALYTICS] Add attribute to content changed by Target for analytics and MWPW-152274 (adobecom#2593) Bootstrapper script for milo feds blocks (adobecom#2560) Revert "[MWPW-152968] mWeb - Passing ECID to Branch.io banner - Implementation" (adobecom#2612) # Conflicts: # libs/deps/merch-card.js
In Dexter, there are scripts that add analytics to portions of a page that have been updated by Target. These scripts key off an attribute added by the testing library the T&O team uses. As pages migrate to milo, these scripts need the attribute once again.
Resolves: MWPW-146528
Also resolves:
MWPW-152274 Move entitlements.js request up to happen while waiting on sstats / etc.
MWPW-152275 Move manifest.json request up while waiting on sstats / etc.
MWPW-154998 [MEP][MILO] Manifests do not execute in the right order when there is a disabled manifest
Instructions for testing:
Use the MEP button to switch between experiences. For each, copy and paste the following into the console:
document.querySelectorAll('[data-adobe-target-testid]')
In the before link, no experience will have elements with the attributes.
Test URLs:
--Before: https://main--cc--adobecom.hlx.page/drafts/mepdev/fragments/2024/q3/addanalyticsattribute/addanalyticsattribute
--After: https://main--cc--adobecom.hlx.page/drafts/mepdev/fragments/2024/q3/addanalyticsattribute/addanalyticsattribute?milolibs=mepmovefromutils
In the after links, expected value for any found elements should be "myoverride" and the amount of found elements should match the numbers listed below.
Number of expected found elements by experience:
target-replacepage: 1
target-otheractions: 8
all others: 0
Test URLs:
--Before: https://main--cc--adobecom.hlx.page/drafts/mepdev/fragments/2024/q3/addanalyticsattribute/inblockgnavversion
--After: https://main--cc--adobecom.hlx.page/drafts/mepdev/fragments/2024/q3/addanalyticsattribute/inblockgnavversion?milolibs=mepmovefromutils
In the after links, expected value for any found elements should be "apples" and the amount of found elements should match the numbers listed below.
Number of expected found elements by experience:
target-block: 1
target-gnavfragment: 1
target-gnavchainfragments: 1
target-gnavwithinset: 2
all others: 0
Test URL for psi check:
https://mepmovefromutils--milo--adobecom.hlx.page/?martech=off