Microsoft cloud engineer - SharePoint, Office 365, Azure, DotNet, Angular, JavaScript.
Microsoft cloud engineer - SharePoint, Office 365, Azure, DotNet, Angular, JavaScript.

VIDEO – SPFx Application Customizer for Google Analytics tracking Modern SPO

Demo how to inject Google Analytics traffic tracking JavaScript to any Modern SharePoint Online site with SPFX .   Full coding demo shows steps for coding, configuration, deployment, and testing.   Modern page UI is tightly controlled by Microsoft to keep customers on the product roadmap.   Using SPFX to inject Application Customizer is the recommended and supported method to Also feel free to download the complete SPPKG package, upload to App Catalog, and deploy to any SPO site collection on your tenant.   Simply change the final PowerShell cmdlet (Add-PnPCustomAction) to have the correct Google Analytics Tracking ID for your GA Property. Cheers. 

shades_smile

Video

SPPKG Code

PNP Install

Connect-PnPOnline -UseWebLogin -Url https://spjeff.sharepoint.com
Get-PnPWeb
# Use GUID from SPFX MANIFEST.JSON
Add-PnPCustomAction -ClientSideComponentId "c430bd95-a1ac-4edd-9e25-7dbf3358062b" -Name "Google Analytics for SharePoint" -Title "GA for SharePoint" -Location ClientSideExtension.ApplicationCustomizer -ClientSideComponentProperties: '{"trackingID":"UA-5417707-7"}' -Scope Site
Get-PnPCustomAction -Scope Site

Screenshots

image
image
image
image
image
image
image

References

    © Copyright 2016
    @ SPJeff

    Return to Top ▲Return to Top ▲