Site URL: https://storiesone.com
Hello everyone,
I am struggling to add a facebook pixel event on an image link click on squarespace. On the website it is the join Discord image, that open our Discord link and I want to be able to target people that perform this action most of the time.
First, I tried to use the No code facebook pixel event manager solution but it doesn't recognized the event when I click on the image.
Then I tried using the code injection solution but still doesn't work.
I have injected this code inspired from a stackoverflow post in the squarespace code injection header space:
<script>
(function() {
var blockBtns = document.getElementsByClassName("sqs-block-image-link");
for (var i = 0; i < blockBtns.length; i++) blockBtns[i].addEventListener("click", function() {
fbq("track", "Discord Click", {
});
});
})();
</script>
The result is:
Just after opening the website page, I have this message on the facebook pixel helper chrome extension ( i still did not click on the Discord button)
When I click on the Discord image, nothing change on the facebook pixel helper.
If someone can help me solve that situation that would be awesome 🙂