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

Add storefront events SDK and collector #21

Merged
merged 6 commits into from
Mar 15, 2024
Merged

Add storefront events SDK and collector #21

merged 6 commits into from
Mar 15, 2024

Conversation

herzog31
Copy link

@herzog31 herzog31 commented Jan 9, 2024

  • Added @adobe/magento-storefront-event-collector.
  • Added @adobe/magento-storefront-events-sdk (only as dependency for collector).
  • Added script that copies above npm dependencies into /scripts folder to allow for easy updating.
  • Added initialization of Events SDK + Collector in delayed phase.
  • Collector depends on non-standard eventInfo field which contains a copy of the current ACDL state. This field does not exist when writing to ACDL directly. This is addressed in Add recommendations block with ACDL #11 which needs to be merged beforehand.

Test URLs:

Copy link

aem-code-sync bot commented Jan 9, 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

aem-code-sync bot commented Jan 9, 2024

Page Scores Audits Google
/ PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

@aem-code-sync aem-code-sync bot temporarily deployed to event-collector March 8, 2024 09:24 Inactive
@aem-code-sync aem-code-sync bot temporarily deployed to event-collector March 8, 2024 10:00 Inactive
@herzog31 herzog31 marked this pull request as ready for review March 8, 2024 10:01
@herzog31 herzog31 requested review from dicagno and hannessolo March 8, 2024 10:01
@herzog31 herzog31 merged commit 2dfc035 into main Mar 15, 2024
2 checks passed
@@ -0,0 +1,5 @@
const fs = require('fs');
Copy link

Choose a reason for hiding this comment

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

@herzog31 you can probably add this file to the .hlxignore list

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the suggestion. Fix available in #45.

@@ -29,5 +30,9 @@
"eslint-plugin-import": "2.29.1",
"stylelint": "16.1.0",
"stylelint-config-standard": "36.0.0"
},
"dependencies": {
"@adobe/magento-storefront-event-collector": "^1.7.1",
Copy link

Choose a reason for hiding this comment

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

@herzog31 Is it ok to use versions 1.8.0 for @adobe/magento-storefront-event-collector and @adobe/magento-storefront-events-sdk ?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, you can use newer versions.


// Load events SDK and collector
import('./commerce-events-sdk.js');
import('./commerce-events-collector.js');
Copy link

Choose a reason for hiding this comment

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

@herzog31 Since this is all delayed, does it mean that any event occurring after 3s will not be collected ? E.g. if the user clicks away or closes the window before this is loaded ?

Copy link
Author

Choose a reason for hiding this comment

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

If a user leaves the page before this is loaded, the events will not be collected. That's correct and unfortunately a known limitation.

There are some ideas to fix this in https://git.corp.adobe.com/mabecker/acdl2 which can persist events in session storage to make sure they can be collected on the next page. But this will take some more work and will be added to the mainline ACDL in the near future.

@herzog31 herzog31 added changelog Important when updating projects and removed PREVIEW labels Jun 6, 2024
dpatil-magento pushed a commit that referenced this pull request Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog Important when updating projects
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants