Hi there,
Thank you for posting!
Could you please confirm that you’ve also completed step 2 for the SFRA section for adding the snippets? In addition, could you please confirm that the Klaviyo Cartridge is active and contains the necessary API keys?
The Cartridge will only send the metrics if it’s active and the API keys have been added to the settings appropriately.
If all of these requirements are met, then could you please confirm if you’re seeing any error messages on the Salesforce side? If so, would you please share them here? Thank you!
Thanks Chuck.
Yes, I have set up Step 2.
And the Klaviyo Cartridge is Active with correct API keys.
However, how would I use this function in Cart.js if I wanted to prepend this to AddProduct?
ie.
server.prepend('AddProduct', function (req, res, next) {
if (dw.system.Site.getCurrent().getCustomPreferenceValue('klaviyo_enabled')) {
var KlaviyoUtils = require('*/cartridge/scripts/utils/klaviyo/klaviyoUtils');
KlaviyoUtils.trackAddToCart();
}
return next();
});
The error I currently get is:
trackEvent() failed for email: undefined. Service Connection for send email via Klaviyo returned null.
I currently have 3 different Salesforce CC websites where I would need these base Cartridges added to. So I was not sure if some of these need to be defined within the app_site_skin itself.
Do you have an example site structure for SFRA + Klaviyo integration?
Cheers
Hi. Can anyone help with the above?
Any Klaviyo team SFRA developers have any advice?
Hi @scullchr,
We’ve looped in a Success Engineer to further troubleshoot this with you so we can get to the bottom of this issue together!
Thanks for sharing your question with the Community!
-Taylor
Later Edit: The issue this user experienced was related to the fact the customer email address was not being added to the Added to Cart events, and so when the API request to Klaviyo is made, the API is rejecting the request. Once the added to cart snippets was correctly placed in the app_storefront_base code the AddProduct function referred to in the documentation fired successfully.
Hi Chuck. Please check my ticket support number 905407