fix(component-header-footer): fix arbitrary timeout in header submit …#1712
fix(component-header-footer): fix arbitrary timeout in header submit …#1712davidornelas11 wants to merge 1 commit into
Conversation
|
Storybook deployed at https://unity-uds-staging.s3.us-west-2.amazonaws.com/pr-1712/index.html |
| region = "", | ||
| component = "", | ||
| eventCallback, | ||
| eventTimeout, |
There was a problem hiding this comment.
Should eventTimeout have a numeric default = 0?
| component: component.toLowerCase(), | ||
| }; | ||
| if (dataLayer) dataLayer.push(e); | ||
| if (eventCallback) e.eventCallback = eventCallback; |
There was a problem hiding this comment.
const e, previously an object of strings, we are now sending a function to data layer (Just bringing this up for discussion).
| if (dataLayer) { | ||
| dataLayer.push(e); | ||
| } else if (eventCallback) { | ||
| eventCallback(); |
There was a problem hiding this comment.
We are adding a feature to this shared component, I don't think there is anything wrong with this, but I would like to discuss.
| // Fallback: always submit within 2s regardless of GTM state. Useful for | ||
| // cases where GTM fails to load or execute for any reason, or if the user | ||
| // has blocked GTM. | ||
| setTimeout(submit, 2000); |
There was a problem hiding this comment.
I see the comment about GTM state, however I think the function for trackGAEvent should always execute regardless of GTM setTimeout(submit, 2000); not needed here.
| if (dataLayer) { | ||
| dataLayer.push(e); | ||
| } else if (eventCallback) { | ||
| eventCallback(); |
There was a problem hiding this comment.
setTimeout(submit, 2000);
Do we need to add a callback parameter and a timeout parameter?
Timeout could be added inside callback? Callback = ()=>{ setTimeout(submit, 2000); }
GTM can see Form submission natively, without dataLayer method.
I know we have talked about this before, but I'd like to discuss again to make sure we have all options before adding a 2 second timeout to all submissions
…function
Description
Checklist
Important Reminders
Links