Missing tags

This commit is contained in:
Laurent Destailleur 2020-06-11 17:07:41 +02:00
parent 78204f92e6
commit 3831b56423
2 changed files with 68 additions and 15 deletions

View File

@ -337,23 +337,25 @@ elseif (!empty($moreloginextracontent)) {
echo $moreloginextracontent;
}
// Google Analytics (need Google module)
// Google Analytics
// TODO Add a hook here
if (!empty($conf->google->enabled) && !empty($conf->global->MAIN_GOOGLE_AN_ID))
{
if (empty($conf->dol_use_jmobile))
{
$tmptagarray = explode(',', $conf->global->MAIN_GOOGLE_AN_ID);
foreach($tmptagarray as $tmptag) {
print "\n";
print "<!-- JS CODE TO ENABLE for google analtics tag -->\n";
print "
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src=\"https://www.googletagmanager.com/gtag/js?id=".trim($tmptag)."\"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '".trim($tmptag)."');
</script>";
print "\n";
print '<script type="text/javascript">'."\n";
print ' var _gaq = _gaq || [];'."\n";
print ' _gaq.push([\'_setAccount\', \''.$conf->global->MAIN_GOOGLE_AN_ID.'\']);'."\n";
print ' _gaq.push([\'_trackPageview\']);'."\n";
print ''."\n";
print ' (function() {'."\n";
print ' var ga = document.createElement(\'script\'); ga.type = \'text/javascript\'; ga.async = true;'."\n";
print ' ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'.google-analytics.com/ga.js\';'."\n";
print ' var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(ga, s);'."\n";
print ' })();'."\n";
print '</script>'."\n";
}
}

View File

@ -206,7 +206,13 @@ if (!empty($morelogincontent)) {
</div>
<?php } ?>
<?php if (!empty($morelogincontent) && is_array($morelogincontent)) {
<!-- Common footer is not used for passwordforgotten page, this is same than footer but inside passwordforgotten tpl -->
<?php
if (!empty($conf->global->MAIN_HTML_FOOTER)) print $conf->global->MAIN_HTML_FOOTER;
if (!empty($morelogincontent) && is_array($morelogincontent)) {
foreach ($morelogincontent as $format => $option)
{
if ($format == 'js') {
@ -219,8 +225,53 @@ elseif (!empty($moreloginextracontent)) {
echo '<!-- Javascript by hook -->';
echo $moreloginextracontent;
}
// Google Analytics
// TODO Add a hook here
if (!empty($conf->google->enabled) && !empty($conf->global->MAIN_GOOGLE_AN_ID))
{
$tmptagarray = explode(',', $conf->global->MAIN_GOOGLE_AN_ID);
foreach($tmptagarray as $tmptag) {
print "\n";
print "<!-- JS CODE TO ENABLE for google analtics tag -->\n";
print "
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src=\"https://www.googletagmanager.com/gtag/js?id=".trim($tmptag)."\"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '".trim($tmptag)."');
</script>";
print "\n";
}
}
// Google Adsense
if (!empty($conf->google->enabled) && !empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && !empty($conf->global->MAIN_GOOGLE_AD_SLOT))
{
if (empty($conf->dol_use_jmobile))
{
?>
<div class="center"><br>
<script type="text/javascript"><!--
google_ad_client = "<?php echo $conf->global->MAIN_GOOGLE_AD_CLIENT ?>";
google_ad_slot = "<?php echo $conf->global->MAIN_GOOGLE_AD_SLOT ?>";
google_ad_width = <?php echo $conf->global->MAIN_GOOGLE_AD_WIDTH ?>;
google_ad_height = <?php echo $conf->global->MAIN_GOOGLE_AD_HEIGHT ?>;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
<?php
}
}
?>
</div>
</div> <!-- end of center -->