Skip to content

Blazor extensions for Analytics: Google Analytics, GTAG, ...

License

Notifications You must be signed in to change notification settings

dinonovak/blazor-analytics

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blazor extensions for Analytics: Google Analytics, GTAG, ...
AspNetCore Version: 3.0.0

NuGet Package

https://nuget.org/packages/Blazor-Analytics

Configuration

Google Analytics, GTAG

First, import the component in _Imports.razor

@using Blazor.Analytics.GoogleAnalytics.Components

Then, add the GoogleAnalytics component below your Router in App.razor.
The tracker listens to every navigation change while it's rendered on a page.

    <Router ... />
+   <GoogleAnalytics TrackingId="UA-XXXXXXXXX-X" />

ServerSide Specific Configuration

Edit _Host.cshtml and apply the following change:

    <script src="_framework/blazor.server.js"></script>
+   <script src="_content/Blazor-Analytics/blazor-analytics.js"></script>

WASM Specific Configuration

Edit index.html and apply the following change:

    <script src="_framework/blazor.webassembly.js"></script>
+   <script src="_content/Blazor-Analytics/blazor-analytics.js"></script>

Changelog

v3.0.0

  • Added support for
    • ServerSide (pre-rendering)
    • ServerSide (runtime)
    • WASM (runtime)

About

Blazor extensions for Analytics: Google Analytics, GTAG, ...

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 62.8%
  • TypeScript 34.9%
  • HTML 2.3%