gpt4 book ai didi

django - 如何在django-analytical中使用通用的“analytical。*”标签

转载 作者:行者123 更新时间:2023-12-03 17:12:38 24 4
gpt4 key购买 nike

我尝试按照以下指南为django项目的django-analytical设置Google Analytics(分析):http://pythonhosted.org/django-analytical/services/google_analytics.html#google-analytics-configuration

在本指南中,您可以找到以下语句:
“接下来,您需要在模板中添加Google Analytics(分析)模板标记。仅当您不使用通用的analytic。*标记时才需要执行此步骤。如果需要,请跳至“配置”。

所以我的问题是:将这个通用的analytic。*标签放在哪里?它在我的settings.py文件中的某个地方吗?

谢谢。

最佳答案

如果您打算使用Google Analytics(分析)作为服务,则只需将以下内容添加到template / base.html中:

{% load google_analytics %}
<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>My Website: {{ title }}</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<meta charset="UTF-8">

{% block css %}
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/ui-lightness/jquery-ui.css">
<link rel="stylesheet" href="{{ STATIC_URL }}bootstrap/css/bootstrap-tokenfield.css">
<link rel="stylesheet" href="{{ STATIC_URL }}bootstrap/css/bootstrap.css">
<link rel="stylesheet" href="{{ STATIC_URL }}bootstrap/css/font-awesome.min.css">
<link rel="stylesheet" href="{{ STATIC_URL }}css/main.css">
{% endblock css %}


<!-- fix so that IE 9 and less will properly recognize html5 elements -->
<!--[if lt IE 9]>
<script src="dist/html5shiv.js"></script>
<![endif]-->
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
{% google_analytics %}
</head>


请参阅以下文档: https://pythonhosted.org/django-analytical/services/google_analytics.html

我相信,它们在您发布的链接上引用的通用analytical。*标签与以下内容有关。如果我输入的内容不正确,请其他人发出声音并提供正确的答复。 HTH。

{% load analytical %}
<!DOCTYPE ... >
<html>
<head>
{% analytical_head_top %}



{% analytical_head_bottom %}
</head>
<body>
{% analytical_body_top %}



{% analytical_body_bottom %}
</body>
</html>

关于django - 如何在django-analytical中使用通用的“analytical。*”标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20688299/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com