mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-14 17:22:54 -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,
|
||||
TvShow,
|
||||
Album,
|
||||
Request
|
||||
Request,
|
||||
Language
|
||||
}
|
||||
}
|
|
@ -37,5 +37,6 @@ namespace PlexRequests.Helpers.Analytics
|
|||
Issues,
|
||||
UserLogin,
|
||||
Services,
|
||||
Navbar
|
||||
}
|
||||
}
|
|
@ -25,6 +25,7 @@
|
|||
// ************************************************************************/
|
||||
#endregion
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Nancy;
|
||||
using Nancy.Extensions;
|
||||
|
@ -32,18 +33,24 @@ using Nancy.Responses;
|
|||
|
||||
using PlexRequests.Core;
|
||||
using PlexRequests.Core.SettingModels;
|
||||
using PlexRequests.Helpers;
|
||||
using PlexRequests.Helpers.Analytics;
|
||||
using PlexRequests.UI.Helpers;
|
||||
|
||||
namespace PlexRequests.UI.Modules
|
||||
{
|
||||
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 returnUrl = (string)Request.Query["u"];
|
||||
|
@ -60,10 +67,11 @@ namespace PlexRequests.UI.Modules
|
|||
{
|
||||
Cookies.Add(CultureCookieName, culture);
|
||||
}
|
||||
var cookie = Cookies["_culture"];
|
||||
var cookie = Cookies[CultureCookieName];
|
||||
var response = Context.GetRedirect(returnUrl);
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
}
|
||||
}
|
||||
<div>
|
||||
<h1>@UI.Seach_SearchTitle</h1>
|
||||
<h1>@UI.Search_Title</h1>
|
||||
<h4>@UI.Search_Paragraph</h4>
|
||||
<br />
|
||||
<!-- Nav tabs -->
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
@Html.GetNavbarUrl(Context, "/issues", UI.Layout_Issues, "exclamation", "<span id=\"issueCount\"></span>")
|
||||
@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 class="nav navbar-nav navbar-right">
|
||||
|
@ -103,6 +103,12 @@
|
|||
</html>
|
||||
<script>
|
||||
|
||||
function donateClick(url) {
|
||||
ga('send', 'event', 'Navbar', 'Donate', 'Donate Clicked');
|
||||
var redirectWindow = window.open(url, '_blank');
|
||||
redirectWindow.location;
|
||||
}
|
||||
|
||||
$(function () {
|
||||
|
||||
var urlBase = '@Html.GetBaseUrl()';
|
||||
|
@ -142,6 +148,8 @@
|
|||
// End Scroller
|
||||
|
||||
|
||||
|
||||
|
||||
// Get Issue count
|
||||
var issueUrl = createBaseUrl(urlBase, '/issues/issuecount');
|
||||
$.ajax({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue