Tracking pixel with Angular.js


#1

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&amp;cd[value]=0.00&amp;cd[currency]=EUR&amp;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.