Hi all,
Maybe a super simple question but we got the following situation:
Customer can take a test to find the right product, at the end they get a result with best matching products. They can leave there email behind which we are gonna use within Klaviyo to send them the test results and more information about the products that best matched.
On filling in the form and clicking send, the even “customer-info” shoots with some variables like the email they left behind and the advicedproducts.
We want to make sure that the event is linked to the email thats left behind and if the email is not within Klaviyo, its added and subscribed to a list.
How could we do this?
// AIDEN TO KLAVIYO
var _learnq = _learnq || [];
// Listen for events on the webpage
window.addEventListener("message", function (event) {
// Check if the event is from Aiden and if it is the
// customer info submission event
if (event.data.advisorId && event.data.type === "customer-info") {
// Access the event data using event.data
var email = event.data.data.email
var checkboxChecked = event.data.data.checkboxChecked
var advicedproducts = event.data.data.advice
// Custom Klaviyo Event
var item = {
"AdvicedProducts": advicedproducts
};
_learnq.push(['track', 'Adviced Products',{
"Adviced Products": advicedproducts
}]);
console.log("Adviced Products:", advicedproducts);
console.log('Adviced Products triggered :)');
}
});
// END AIDEN TO KLAVIYO
I appreciate the help!
Kind regards,
Marc