feat: add google analytics
This commit is contained in:
@@ -66,5 +66,6 @@ jobs:
|
||||
username: ${{ secrets.SSH_USERNAME }}
|
||||
key: ${{ secrets.SSH_KEY }}
|
||||
script: |
|
||||
export GOOGLE_ANALYTICS_TAG="${{ secrets.GOOGLE_ANALYTICS_TAG }}"
|
||||
chmod +x blog.stevanfreeborn.com/deploy.ps1
|
||||
sudo pwsh ./blog.stevanfreeborn.com/deploy.ps1 ${{ needs.build.outputs.version }}
|
||||
+2
-1
@@ -8,7 +8,8 @@ function StartContainer {
|
||||
|
||||
$containerName = "blog.stevanfreeborn.com.$containerColor"
|
||||
$postDirEnv = "FilePostServiceOptions__PostsDirectory=wwwroot/posts"
|
||||
$containerId = docker run -d -p 8080 --name $containerName --env $postDirEnv $dockerTag
|
||||
$googleTagEnv = "GoogleAnalyticsTag=$env:GOOGLE_ANALYTICS_TAG"
|
||||
$containerId = docker run -d -p 8080 --name $containerName --env $postDirEnv --env $googleTagEnv $dockerTag
|
||||
|
||||
if ($LASTEXITCODE -ne 0)
|
||||
{
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Blazor-Analytics" Version="3.12.0" />
|
||||
<PackageReference Include="Markdig" Version="0.36.2" />
|
||||
<PackageReference Include="System.ServiceModel.Syndication" Version="8.0.0" />
|
||||
<PackageReference Include="TestableIO.System.IO.Abstractions.Wrappers" Version="21.0.2" />
|
||||
|
||||
@@ -13,10 +13,12 @@
|
||||
|
||||
<body>
|
||||
<Routes />
|
||||
<NavigationTracker />
|
||||
<script src="https://cdn.jsdelivr.net/npm/anchor-js/anchor.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.11/dist/clipboard.min.js"></script>
|
||||
<script src="prism.js"></script>
|
||||
<script src="_framework/blazor.web.js"></script>
|
||||
<script src="_content/Blazor-Analytics/blazor-analytics.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
@@ -9,3 +9,5 @@
|
||||
@using Blog
|
||||
@using Blog.Components
|
||||
@using Blog.Components.Utils
|
||||
@using Blazor.Analytics
|
||||
@using Blazor.Analytics.Components
|
||||
@@ -1,3 +1,5 @@
|
||||
using Blazor.Analytics;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
builder.Services.ConfigureOptions<FilePostServiceOptionsSetup>();
|
||||
@@ -6,6 +8,9 @@ builder.Services.AddScoped<IPostService, FilePostService>();
|
||||
|
||||
builder.Services.AddRazorComponents();
|
||||
|
||||
var googleTag = builder.Configuration["GoogleAnalyticsTag"];
|
||||
builder.Services.AddGoogleAnalytics(googleTag);
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
if (app.Environment.IsProduction())
|
||||
|
||||
@@ -10,5 +10,6 @@
|
||||
"FilePostServiceOptions": {
|
||||
"PostsDirectory": "wwwroot/posts"
|
||||
},
|
||||
"DetailedErrors": "true"
|
||||
"DetailedErrors": "true",
|
||||
"GoogleAnalyticsTag": ""
|
||||
}
|
||||
Reference in New Issue
Block a user