Skip to content
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-161845: basic analytics on mas cards #3206

Open
wants to merge 2 commits into
base: ccd
Choose a base branch
from
Open

MWPW-161845: basic analytics on mas cards #3206

wants to merge 2 commits into from

Conversation

3ch023
Copy link
Contributor

@3ch023 3ch023 commented Nov 15, 2024

Copy link
Contributor

aem-code-sync bot commented Nov 15, 2024

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
In case there are problems, just click a checkbox below to rerun the respective action.

  • Re-run PSI checks
  • Re-sync branch
Commits

Copy link
Contributor

aem-code-sync bot commented Nov 15, 2024

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

Copy link

codecov bot commented Nov 15, 2024

Codecov Report

Attention: Patch coverage is 70.58824% with 5 lines in your changes missing coverage. Please review.

Project coverage is 96.37%. Comparing base (6f4d98c) to head (54f947d).

Files with missing lines Patch % Lines
libs/features/mas/web-components/src/hydrate.js 68.75% 5 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            stage    #3206   +/-   ##
=======================================
  Coverage   96.37%   96.37%           
=======================================
  Files         245      245           
  Lines       56716    56733   +17     
=======================================
+ Hits        54661    54678   +17     
  Misses       2055     2055           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -237,6 +251,7 @@ export async function hydrate(fragmentData, merchCard) {
merchCard.removeAttribute('badge-color');
merchCard.removeAttribute('badge-text');
merchCard.removeAttribute('size');
merchCard.removeAttribute('daa-ll');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why would there be a daa-ll attribute there?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will fix to 'daa-lh'

@@ -90,6 +90,7 @@ export class MerchCard extends LitElement {
reflect: true,
},
merchOffer: { type: Object },
analyticsId: { type: String, attribute: 'daa-lh', reflect: true },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could reuse constant from hydrate for daa-lh

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really think that we should not use. daa-* to avoid conflict with martech, since here it is merely a metadata to be consumed by CCD consumer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the plan is that it will be not just metadata, but also a field for martech (so the conflict is intended)
e.g. for plans these attributes will serve the analytics values for martech

Comment on lines +233 to +234
merchCard.querySelectorAll(`a[data-analytics-id]`).forEach((link) => {
link.setAttribute(ANALYTICS_LINK_ATTR, `${link.dataset.analyticsId}--${cardAnalyticsId}`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
merchCard.querySelectorAll(`a[data-analytics-id]`).forEach((link) => {
link.setAttribute(ANALYTICS_LINK_ATTR, `${link.dataset.analyticsId}--${cardAnalyticsId}`);
merchCard.querySelectorAll(`a[data-analytics-id]`).forEach((link, index) => {
link.setAttribute(ANALYTICS_LINK_ATTR, `${index}-${link.dataset.analyticsId}`);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think dubbing the card lh is not at mas responsibility scope. However it's nice for everyone to get link index within the card

Copy link
Contributor

This pull request is not passing all required checks. Please see this discussion for information on how to get all checks passing. Inconsistent checks can be manually retried. If a test absolutely can not pass for a good reason, please add a comment with an explanation to the PR.

@3ch023 3ch023 changed the base branch from stage to ccd November 18, 2024 11:44
@@ -90,6 +90,7 @@ export class MerchCard extends LitElement {
reflect: true,
},
merchOffer: { type: Object },
analyticsId: { type: String, attribute: 'daa-lh', reflect: true },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really think that we should not use. daa-* to avoid conflict with martech, since here it is merely a metadata to be consumed by CCD consumer.

@@ -222,6 +225,17 @@ export function processCTAs(fragment, merchCard, aemFragmentMapping, variant) {
}
}

function processAnalytics(fragment, merchCard) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need a unit rest for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants