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