Browse Source

Add option to customize the AppInsights endpoint

pull/306/head
Clemens Wolff 6 years ago
parent
commit
27d2324d3a
3 changed files with 5 additions and 0 deletions
  1. 1
      app/app/settings.py
  2. 3
      app/server/templates/tags/azure_appinsights.html
  3. 1
      app/server/templatetags/analytics.py

1
app/app/settings.py

@ -274,6 +274,7 @@ GOOGLE_TRACKING_ID = env('GOOGLE_TRACKING_ID', 'UA-125643874-2')
AZURE_APPINSIGHTS_IKEY = env('AZURE_APPINSIGHTS_IKEY', None)
APPLICATION_INSIGHTS = {
'ikey': AZURE_APPINSIGHTS_IKEY if AZURE_APPINSIGHTS_IKEY else None,
'endpoint': env('AZURE_APPINSIGHTS_ENDPOINT', None),
}
## necessary for email verification setup

3
app/server/templates/tags/azure_appinsights.html

@ -7,6 +7,9 @@ var appInsights=window.appInsights||function(a){
{% if DEBUG %}
enableDebug: true,
{% endif %}
{% if azure_appinsights_endpoint %}
endpointUrl: "{{ azure_appinsights_endpoint }}",
{% endif %}
instrumentationKey: "{{ azure_appinsights_ikey }}"
});
window.appInsights=appInsights,appInsights.queue&&0===appInsights.queue.length&&appInsights.trackPageView();

1
app/server/templatetags/analytics.py

@ -15,4 +15,5 @@ def azure_appinsights():
return {
'DEBUG': settings.DEBUG,
'azure_appinsights_ikey': settings.APPLICATION_INSIGHTS['ikey'],
'azure_appinsights_endpoint': settings.APPLICATION_INSIGHTS['endpoint'],
}
Loading…
Cancel
Save