$referer = "-"; } $url .= "&utmr=" . urlencode($referer); if (!empty($path)) { $url .= "&utmp=" . urlencode($path); } $url .= "&guid=ON"; return $url; } ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Sample Mobile Analytics Page</title> </head> <body> Publishers content here. <?php $googleAnalyticsImageUrl = googleAnalyticsGetImageUrl(); ?> <img src="<?php echo $googleAnalyticsImageUrl; ?> " /> Testing: <?php echo $googleAnalyticsImageUrl; ?> </body> </html>
function theme_google_analytics() { global $GA_ACCOUNT; if (!$GA_ACCOUNT) { return ''; } $googleAnalyticsImageUrl = googleAnalyticsGetImageUrl(); return "<img src='{$googleAnalyticsImageUrl}' />"; }
function personalizeContent() { global $GA_ACCOUNT; $search = array(); $replace = array(); $match = array(); if (preg_match('/src="[^%]*(%googleAnalytics:([^%]+)%)"/', $this->content, $match)) { $GA_ACCOUNT = $match[2]; $googleAnalyticsImageUrl = googleAnalyticsGetImageUrl(); $search[] = $match[1]; $replace[] = $googleAnalyticsImageUrl; } $match = array(); if (preg_match('/(href="(tel:([^"]+))")/', $this->content, $match)) { if ($this->deviceInfo['xhtml_make_phone_call_string']) { $search[] = $match[2]; $replace[] = $this->deviceInfo['xhtml_make_phone_call_string'] . $match[3]; } else { $search[] = $match[1]; $replace[] = "onClick=\"alert('Llamanos al {$match[3]}');return false;\""; } } $match = array(); if (preg_match('%src="http://' . $this->remoteServer . '/logos/(([^-]+)-[0-9]{3}.png)"%', $this->content, $match)) { if ($this->deviceInfo['resolution_width'] > 500) { $search[] = $match[1]; $replace[] = $match[2] . "-400.png"; } elseif ($this->deviceInfo['resolution_width'] >= 300) { $search[] = $match[1]; $replace[] = $match[2] . "-300.png"; } else { $search[] = $match[1]; $replace[] = $match[2] . "-200.png"; } } $now = time(); $expire = date("D, d M Y H:i:s", $now + 120); header("Expires:{$expire} GMT"); header("Cache-Control:max-age=3600"); $search[] = '%EXPIRES%'; $replace[] = $expire; $this->content = str_replace($search, $replace, $this->content); }
function include_footer() { global $basePath; echo '<div id="footer"><a href="' . $basePath . 'about.php">About/Contact Us</a> <a href="' . $basePath . 'feedback.php">Feedback/Bug Report</a> <a href="' . $basePath . 'privacy.php">Privacy Policy</a>'; echo '<br/><small> <a rel="license" href="http://creativecommons.org/licenses/by/3.0/au/"><img alt="Creative Commons License" src="http://i.creativecommons.org/l/by/3.0/au/80x15.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/3.0/au/">Creative Commons Attribution 3.0 Australia License</a>.</small></div>'; if (isAnalyticsOn()) { echo "<script type=\"text/javascript\"> (function() {\n var ga = document.createElement('script'); ga.type = \n'text/javascript'; ga.async = true;\n ga.src = ('https:' == document.location.protocol ? \n'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';\n var s = document.getElementsByTagName('script')[0]; \ns.parentNode.insertBefore(ga, s);\n })();</script>"; $googleAnalyticsImageUrl = googleAnalyticsGetImageUrl(); echo '<noscript><div><img src="' . $googleAnalyticsImageUrl . '" alt=""/></div></noscript>'; } echo "\n</div></div></body></html>"; }
public function _output($output) { if ($this->is_mobile) { // Google Anlyticsモバイル設定 if ($this->config->item('google_anlytics_mobile_code', 'config_main') and preg_match("|</body>.*?</html>|is", $output)) { $this->load->helper('google_analytics'); $googleAnalyticsImageUrl = googleAnalyticsGetImageUrl($this->config->item('google_anlytics_mobile_code', 'config_main')); $output = preg_replace("|</body>.*?</html>|is", '', $output); $output .= "<img src=\"" . $googleAnalyticsImageUrl . "\" />\n"; $output .= "</body>\n</html>"; } $output = mb_convert_encoding($output, 'SJIS-win', 'UTF-8'); } echo $output; }