I have a javascript script to track button clicks on-site and send information to Klaviyo. Then I've created a flow in Klaviyo to send email based on a button click "Add To Wishlist" But, it's not working.
I've used query selector based on this post here: getElementsByClassName() with two classes
Because I have 2 classes. Here is a screenshot of them: 1. On Collection Page http://prntscr.com/rn50ok
2.On Product Page: http://prntscr.com/rn51n0
P.S
I understand this may be basic but I have 0 knowledge on javascript and API's I just used documentation that Klaviyo has and tried to create it based on their Add To Cart code.
<script text="text/javascript">
var _learnq = _learnq || [];
var classname = document.querySelectorAll(".yith-wcwl-add-button jas_add_wishlist,.add_nitro_wishlist add_to_wishlist gecko-tooltip");
var myFunction = function() {
_learnq.push(['track', 'Add to Wishlist', item]);
};
for (var i = 0; i < classname.length; i++) {
classname[i].addEventListener('click', myFunction, false);
}
</script>