We are using facebook tracking pixel, to track the performance of our facebook ads. To do so, for every user that comes to our service for the first time we need to fire tracking pixel in DOM. We do it by setting $scope.newReg to true in controller and with following code in template.
<div ng-if="newReg == true">
<img height="1" width="1" alt="" style="display:none" src="https://www.facebook.com/tr?ev=xxxxxx&cd[value]=0.00&cd[currency]=EUR&noscript=1" />
</div>
The question is what is really going on if $scope.newReg is set to false. I guess that tracking pixel should'n be fired, but according to documentation it seems like it can be fired. "If condition is falsy then the element is removed from the DOM tree." Which means that tracking pixel could for a very short moment appear in the DOM and then being removed. And that would fire tracking counter even if condition fails.
Nobody else dealing with this issue?
This answer seems to be working for me: Facebook Custom Audience pixel on SinglePageApplication SPA
But I believe that there are more ways how to handle it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With