public static function init()
 {
     if (SJB_System::getSettingByName('google_TrackingID') != '') {
         $page_head = '<script type="text/javascript">' . 'var _gaq = _gaq || [];' . '_gaq.push(["_setAccount", "' . SJB_System::getSettingByName('google_TrackingID') . '"]);' . '_gaq.push(["_addOrganic", "images.yandex.ru", "text"]);' . '_gaq.push(["_addOrganic", "images.google.ru", "q"]);' . '_gaq.push(["_addOrganic", "go.mail.ru", "q"]);' . '_gaq.push(["_addOrganic", "gogo.ru", "q"]);' . '_gaq.push(["_addOrganic", "nova.rambler.ru", "query"]);' . '_gaq.push(["_addOrganic", "rambler.ru", "words"]);' . '_gaq.push(["_addOrganic", "google.com.ua", "q"]);' . '_gaq.push(["_addOrganic", "search.ua", "q"]);' . '_gaq.push(["_setDomainName", "none"]);' . '_gaq.push(["_setAllowLinker", true]);' . '_gaq.push(["_trackPageview"]);' . '(function() {' . 'var ga = document.createElement("script"); ga.type = "text/javascript"; ga.async = true;' . 'ga.src = ("https:" == document.location.protocol ? "https://ssl" : "http://www") + ".google-analytics.com/ga.js";' . 'var s  = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(ga, s);' . '})();' . '</script>';
         $head = SJB_System::getPageHead();
         SJB_System::setPageHead($head . ' ' . $page_head);
     }
 }
Exemple #2
0
 /**
  * @param $listingSID
  */
 public static function setMetaOpenGraph($listingSID)
 {
     if (!empty($listingSID)) {
         $listing = SJB_ListingManager::getObjectBySID($listingSID);
         $listingStructure = SJB_ListingManager::createTemplateStructureForListing($listing);
         $siteUrl = SJB_System::getSystemSettings("SITE_URL");
         $location = SJB_LocationManager::locationFormat(array("location" => $listingStructure['Location']));
         $locationFormatted = !empty($location) ? " (" . $location . ")" : '';
         $title = htmlspecialchars(strip_tags(trim($listingStructure['Title']))) . $locationFormatted;
         $logoImage = !empty($listingStructure['user']['Logo']['file_url']) ? $listingStructure['user']['Logo']['file_url'] : '';
         $description = self::getListingDescriptionPreparedForSharer($listingStructure);
         $listingUrl = SJB_ListingManager::getListingUrlBySID($listingSID);
         $openGraphMetaBlock = "<meta property=\"og:type\" content=\"website\" />\n\t" . "<meta property=\"og:url\" content=\"{$listingUrl}\" />\n\t" . "<meta property=\"og:title\" content=\"{$title}\" />\n\t" . "<meta property=\"og:description\" content=\"{$description}\" />\n\t" . "<meta property=\"og:site_name\" content=\"{$siteUrl}\" />\n\t" . "<meta property=\"og:image\" content=\"{$logoImage}\" />";
         $head = SJB_System::getPageHead();
         SJB_System::setPageHead($head . ' ' . $openGraphMetaBlock);
     }
 }
 function _tpl_head($params, $content)
 {
     if (empty($content)) {
         return false;
     }
     $head = SJB_System::getPageHead();
     SJB_System::setPageHead($head . ' ' . $content);
 }