TYPO3:计算v 7.6.x中的文件下载次数

时间:2016-10-05 12:26:21

标签: typo3 typo3-7.6.x

是否有用于计算与TYPO3 v 7.6.x兼容的文件下载次数(例如pdf)的扩展名?

对于旧版本dbdownloadtracker或cc_awstats做到了。但不幸的是,它们与7.6.x不兼容。

2 个答案:

答案 0 :(得分:2)

我从其文档中看到,扩展名kk_downloader(https://typo3.org/extensions/repository/view/kk_downloader)有一个"计数器"特征

否则,我认为您可以使用Google Analytics设置内容

答案 1 :(得分:0)

Google Analytics可能是最佳选择,您不依赖于Typo3扩展程序。它适用于任何网站,Typo3与否,但需要在GA脚本之后加载。统计信息显示为Google Analytics中的事件,并且会立即记录在Google中,无需等待数小时即可查看统计信息。

如果使用href="tel:(000)000-0000"设置,它会跟踪从链接点击/调用的下载,外部网站点击,mailto和电话。您可以在HTML中使用自己的手机格式。

它跟踪这些文件扩展名:exe,zip,pdf,doc,docx,xl​​s,xlsx,ppt,pptx。如果您需要更多文件类型,只需添加到var filetypes中由管道分隔的扩展名列表中。

确保使用jQuery或更新代码。



<script type="text/javascript">
if (typeof jQuery != 'undefined') {
	jQuery(document).ready(function($) {
		var filetypes = /\.(exe|zip|pdf|doc*|xls*|ppt*)$/i;
		var baseHref = '';
		if (jQuery('base').attr('href') != undefined) baseHref = jQuery('base').attr('href');
		jQuery('a').each(function() {
			var href = jQuery(this).attr('href');
			if (href && (href.match(/^https?\:/i)) && (!href.match(document.domain))) {
				jQuery(this).click(function() {
					var extLink = href.replace(/^https?\:\/\//i, '');
					ga('send', 'event', 'External', 'Click', extLink);
					if (jQuery(this).attr('target') != undefined && jQuery(this).attr('target').toLowerCase() != '_blank') {
						setTimeout(function() {
							location.href = href;
						}, 200);
						return false;
					}
				});
			} else if (href && href.match(/^mailto\:/i)) {
				jQuery(this).click(function() {
					var mailLink = href.replace(/^mailto\:/i, '');
					ga('send', 'event', 'Email', 'Click', mailLink);
				});
			} else if (href && href.match(/^tel\:/i)) {
				jQuery(this).click(function() {
					var phoneLink = href.replace(/^tel\:/i, '');
					ga('send', 'event', 'Phone', 'Click', phoneLink);
				});
			} else if (href && href.match(filetypes)) {
				jQuery(this).click(function() {
					var extension = (/[.]/.exec(href)) ? /[^.]+$/.exec(href) : undefined;
					var filePath = href;
					ga('send', 'event', 'Download', 'Click-' + extension, filePath);
					if (jQuery(this).attr('target') != undefined && jQuery(this).attr('target').toLowerCase() != '_blank') {
						setTimeout(function() {
							location.href = baseHref + href;
						}, 200);
						return false;
					}
				});
			}
		});
	});
}
</script>
&#13;
&#13;
&#13;

有关此代码的详细信息,可在此处找到原始文件:http://www.blastam.com/blog/how-to-track-downloads-in-google-analytics,但此答案中的代码使用新的ga事件,并为点击的电话添加了跟踪。

应用此代码后,在Google Analytics中,请勿忘记按默认情况过滤当天.Google会选择此范围,直至今天前一天。

希望这可以帮助那些人。