in src/Facebook/InstantArticles/Transformer/Rules/AnalyticsRule.php [47:76]
public function apply($transformer, $instant_article, $node)
{
$analytics = Analytics::create();
// Builds the analytics
$url = $this->getProperty(self::PROPERTY_TRACKER_URL, $node);
if ($url) {
$analytics->withSource($url);
}
$embed_code = $this->getProperty(self::PROPERTY_TRACKER_EMBED_URL, $node);
if ($embed_code) {
$analytics->withHTML(Transformer::cloneNode($embed_code));
}
if ($url || $embed_code) {
$instant_article->addChild($analytics);
} else {
$transformer->addWarning(
new InvalidSelector(
'embed code or url',
$instant_article,
$node,
$this
)
);
}
return $instant_article;
}