Skip to content

Commit

Permalink
Merge pull request #604 from cabinetoffice/EHD-1411-bug-fix
Browse files Browse the repository at this point in the history
EHD-1411: Reduce code in Core project: Fix bug (Google Analytics Tracker)
  • Loading branch information
jamesgriff authored Nov 20, 2024
2 parents 0b0949d + 81abc97 commit c6d7859
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions GenderPayGap.WebUI/Classes/GoogleAnalyticsTracker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Net;
using System.Net.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Extensions;
using Microsoft.AspNetCore.Mvc;
using Polly;
using Polly.Extensions.Http;
Expand Down Expand Up @@ -61,11 +62,11 @@ public void TrackPageView(Controller controller, string pageTitle = null, string

if (string.IsNullOrWhiteSpace(pageUrl))
{
pageUrl = $"{controller.HttpContext.Request.Path}{controller.HttpContext.Request.QueryString}";
pageUrl = controller.HttpContext.Request.GetDisplayUrl();
}
else if (!IsUrl(pageUrl))
{
pageUrl = RelativeToAbsoluteUrl(pageUrl, new Uri($"{controller.HttpContext.Request.Path}{controller.HttpContext.Request.QueryString}"));
pageUrl = RelativeToAbsoluteUrl(pageUrl, new Uri(controller.HttpContext.Request.GetDisplayUrl()));
}

SendPageViewTracking(pageTitle, pageUrl);
Expand Down

0 comments on commit c6d7859

Please sign in to comment.