One of the rule i tend to use is: if i have to use something twice then i will do a variable for it. So what about:
var siteUrl = target.dataset.siteUrl;
if (siteUrl) {
  new MozActivity({name: 'view', data: { type: 'url', url: siteUrl });
}