Add GOOGLE_ANALYTICS_PROPERTY_IDS for dynamic set ID
This commit is contained in:
parent
007fc794c3
commit
2ad984504c
5 changed files with 18 additions and 18 deletions
|
|
@ -1,16 +0,0 @@
|
|||
from django.conf import settings
|
||||
|
||||
|
||||
def google_analytics(request):
|
||||
"""
|
||||
Use the variables returned in this function to
|
||||
render your Google Analytics tracking code template.
|
||||
"""
|
||||
ga_prop_id = getattr(settings, 'GOOGLE_ANALYTICS_PROPERTY_ID', False)
|
||||
ga_domain = getattr(settings, 'GOOGLE_ANALYTICS_DOMAIN', False)
|
||||
if not settings.DEBUG and ga_prop_id and ga_domain:
|
||||
return {
|
||||
'GOOGLE_ANALYTICS_PROPERTY_ID': ga_prop_id,
|
||||
'GOOGLE_ANALYTICS_DOMAIN': ga_domain,
|
||||
}
|
||||
return {}
|
||||
|
|
@ -33,6 +33,9 @@
|
|||
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
|
||||
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<!-- Google analytics -->
|
||||
{% include "google_analytics.html" %}
|
||||
<!-- End Google Analytics -->
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
|
@ -47,9 +50,6 @@
|
|||
{% include "datacenterlight/includes/_footer.html" %}
|
||||
<!-- Footer -->
|
||||
|
||||
<!-- Google analytics -->
|
||||
{% include "datacenterlight/includes/_google_analytics.html" %}
|
||||
|
||||
<!-- jQuery -->
|
||||
<script src="{% static 'datacenterlight/js/jquery.js' %}"></script>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
<!-- Google Analytics -->
|
||||
{% if GOOGLE_ANALYTICS_PROPERTY_ID %}
|
||||
<script>
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
|
||||
|
||||
ga('create', '{{ GOOGLE_ANALYTICS_PROPERTY_ID }}', '{{ GOOGLE_ANALYTICS_DOMAIN }}');
|
||||
ga('send', 'pageview');
|
||||
</script>
|
||||
{% else %}
|
||||
<!-- Empty analytics -->
|
||||
{% endif %}
|
||||
<!-- End Google Analytics -->
|
||||
|
|
@ -1,8 +1,7 @@
|
|||
{% extends "hosting/base_short.html" %}
|
||||
{% load staticfiles bootstrap3 %}
|
||||
{% load i18n %}
|
||||
{% block content %}
|
||||
{% include 'datacenterlight/includes/_google_analytics.html' %}
|
||||
{% block content %}
|
||||
<div class="order-detail-container">
|
||||
{% if messages %}
|
||||
<div class="row">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue