mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-15 01:32:55 -07:00
Analytics and fixes
This commit is contained in:
parent
0d4573e723
commit
f0fb065237
5 changed files with 25 additions and 7 deletions
|
@ -39,6 +39,7 @@ namespace PlexRequests.Helpers.Analytics
|
||||||
Movie,
|
Movie,
|
||||||
TvShow,
|
TvShow,
|
||||||
Album,
|
Album,
|
||||||
Request
|
Request,
|
||||||
|
Language
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -37,5 +37,6 @@ namespace PlexRequests.Helpers.Analytics
|
||||||
Issues,
|
Issues,
|
||||||
UserLogin,
|
UserLogin,
|
||||||
Services,
|
Services,
|
||||||
|
Navbar
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -25,6 +25,7 @@
|
||||||
// ************************************************************************/
|
// ************************************************************************/
|
||||||
#endregion
|
#endregion
|
||||||
using System;
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
using Nancy;
|
using Nancy;
|
||||||
using Nancy.Extensions;
|
using Nancy.Extensions;
|
||||||
|
@ -32,18 +33,24 @@ using Nancy.Responses;
|
||||||
|
|
||||||
using PlexRequests.Core;
|
using PlexRequests.Core;
|
||||||
using PlexRequests.Core.SettingModels;
|
using PlexRequests.Core.SettingModels;
|
||||||
|
using PlexRequests.Helpers;
|
||||||
|
using PlexRequests.Helpers.Analytics;
|
||||||
using PlexRequests.UI.Helpers;
|
using PlexRequests.UI.Helpers;
|
||||||
|
|
||||||
namespace PlexRequests.UI.Modules
|
namespace PlexRequests.UI.Modules
|
||||||
{
|
{
|
||||||
public class CultureModule : BaseModule
|
public class CultureModule : BaseModule
|
||||||
{
|
{
|
||||||
public CultureModule(ISettingsService<PlexRequestSettings> pr) : base("culture",pr)
|
public CultureModule(ISettingsService<PlexRequestSettings> pr, IAnalytics a) : base("culture",pr)
|
||||||
{
|
{
|
||||||
Get["/"] = x => SetCulture();
|
Analytics = a;
|
||||||
|
|
||||||
|
Get["/", true] = async(x,c) => await SetCulture();
|
||||||
}
|
}
|
||||||
|
|
||||||
public RedirectResponse SetCulture()
|
private IAnalytics Analytics { get; }
|
||||||
|
|
||||||
|
public async Task<RedirectResponse> SetCulture()
|
||||||
{
|
{
|
||||||
var culture = (string)Request.Query["l"];
|
var culture = (string)Request.Query["l"];
|
||||||
var returnUrl = (string)Request.Query["u"];
|
var returnUrl = (string)Request.Query["u"];
|
||||||
|
@ -60,10 +67,11 @@ namespace PlexRequests.UI.Modules
|
||||||
{
|
{
|
||||||
Cookies.Add(CultureCookieName, culture);
|
Cookies.Add(CultureCookieName, culture);
|
||||||
}
|
}
|
||||||
var cookie = Cookies["_culture"];
|
var cookie = Cookies[CultureCookieName];
|
||||||
var response = Context.GetRedirect(returnUrl);
|
var response = Context.GetRedirect(returnUrl);
|
||||||
|
|
||||||
response.WithCookie(CultureCookieName, cookie ?? culture, DateTime.Now.AddYears(1));
|
response.WithCookie(CultureCookieName, cookie ?? culture, DateTime.Now.AddYears(1));
|
||||||
|
await Analytics.TrackEventAsync(Category.Navbar, PlexRequests.Helpers.Analytics.Action.Language, culture, Username, CookieHelper.GetAnalyticClientId(Cookies));
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
<div>
|
<div>
|
||||||
<h1>@UI.Seach_SearchTitle</h1>
|
<h1>@UI.Search_Title</h1>
|
||||||
<h4>@UI.Search_Paragraph</h4>
|
<h4>@UI.Search_Paragraph</h4>
|
||||||
<br />
|
<br />
|
||||||
<!-- Nav tabs -->
|
<!-- Nav tabs -->
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
@Html.GetNavbarUrl(Context, "/issues", UI.Layout_Issues, "exclamation", "<span id=\"issueCount\"></span>")
|
@Html.GetNavbarUrl(Context, "/issues", UI.Layout_Issues, "exclamation", "<span id=\"issueCount\"></span>")
|
||||||
@if (Context.CurrentUser.IsAuthenticated()) // TODO replace with IsAdmin
|
@if (Context.CurrentUser.IsAuthenticated()) // TODO replace with IsAdmin
|
||||||
{
|
{
|
||||||
<li><a href="https://www.paypal.me/PlexRequestsNet" target="_blank"><i class="fa fa-heart" style="color: red"></i> @UI.Layout_Donate</a></li>
|
<li><a id="donate" onclick="donateClick('https://www.paypal.me/PlexRequestsNet');"><i class="fa fa-heart" style="color: red"></i> @UI.Layout_Donate</a></li>
|
||||||
}
|
}
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="nav navbar-nav navbar-right">
|
<ul class="nav navbar-nav navbar-right">
|
||||||
|
@ -103,6 +103,12 @@
|
||||||
</html>
|
</html>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
function donateClick(url) {
|
||||||
|
ga('send', 'event', 'Navbar', 'Donate', 'Donate Clicked');
|
||||||
|
var redirectWindow = window.open(url, '_blank');
|
||||||
|
redirectWindow.location;
|
||||||
|
}
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
|
|
||||||
var urlBase = '@Html.GetBaseUrl()';
|
var urlBase = '@Html.GetBaseUrl()';
|
||||||
|
@ -142,6 +148,8 @@
|
||||||
// End Scroller
|
// End Scroller
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Get Issue count
|
// Get Issue count
|
||||||
var issueUrl = createBaseUrl(urlBase, '/issues/issuecount');
|
var issueUrl = createBaseUrl(urlBase, '/issues/issuecount');
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue