#233 adding google analytics support to the map page
This commit is contained in:
parent
0be4160793
commit
4743c5b385
@ -144,9 +144,24 @@
|
||||
<div class="century" id="rangeText"></div>
|
||||
<div>
|
||||
<p>
|
||||
نقشهٔ خاستگاه سخنسرایان گنجور
|
||||
نقشهٔ خاستگاه سخنسرایان گنجور
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@if (!string.IsNullOrEmpty(ViewData["GoogleAnalyticsCode"].ToString()))
|
||||
{
|
||||
<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', '@ViewData["GoogleAnalyticsCode"]', 'auto');
|
||||
ga('send', 'pageview');
|
||||
|
||||
</script>
|
||||
}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@ -4,6 +4,7 @@ using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using RMuseum.Models.Ganjoor.ViewModels;
|
||||
|
||||
@ -73,6 +74,7 @@ namespace GanjooRazor.Pages
|
||||
|
||||
public async Task<IActionResult> OnGetAsync()
|
||||
{
|
||||
ViewData["GoogleAnalyticsCode"] = _configuration["GoogleAnalyticsCode"];
|
||||
await _PreparePoetGroups();
|
||||
return Page();
|
||||
}
|
||||
@ -82,13 +84,15 @@ namespace GanjooRazor.Pages
|
||||
/// </summary>
|
||||
private readonly HttpClient _httpClient;
|
||||
|
||||
/// <summary>
|
||||
/// configration file reader (appsettings.json)
|
||||
/// </summary>
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
|
||||
public MapModel(
|
||||
HttpClient httpClient
|
||||
)
|
||||
public MapModel(HttpClient httpClient, IConfiguration configuration)
|
||||
{
|
||||
_httpClient = httpClient;
|
||||
_configuration = configuration;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user