Viva Insights Sample Code Library
This repository contains sample code for the Viva Insights open-source packages, including code that is used in tutorials or demos. The sample code shown here covers more elaborate scenarios and examples that leverage, but are not included in the R and Python packages themselves.
Is this page for me?
New to Viva Insights? If youβre just getting started with Viva Insights, we recommend beginning with the Viva Insights Power BI templates and official documentation. These provide pre-built dashboards and reports that deliver immediate value without requiring any coding experience.
Ready for Advanced Analysis? This sample code library is designed for analysts, data scientists, and researchers who have some experience with Viva Insights and want to unlock deeper insights through custom analysis and advanced analytics. Whether youβre looking to:
- Build predictive models to identify top performers or at-risk employees
- Create custom visualizations and dashboards beyond standard templates
- Perform statistical analysis and hypothesis testing on collaboration patterns
- Develop organizational network analysis (ONA) to understand informal influence structures
- Measure and optimize Microsoft Copilot adoption across your organization
- Automate recurring analyses and build scalable analytics workflows
β¦this library provides the tools and examples you need to get started.
Built for Data Scientists
Most scripts in this library are written in R and Python - the most popular data science languages for automation, experimentation, and advanced statistical analysis. To accelerate your work, weβve developed dedicated packages that handle the complexities of Viva Insights data processing:
- vivainsights R package - Comprehensive toolkit for R users with 100+ functions for data manipulation and visualization
- vivainsights Python package - Full-featured Python library optimized for data science workflows
These packages allow analysts to hit the ground running without writing data processing code from scratch, so you can focus on analysis rather than data wrangling.
Special Focus: Copilot Analytics
With the rapid adoption of Microsoft Copilot across organizations, understanding usage patterns and measuring impact has become critical. Our dedicated Copilot Analytics section provides specialized scripts and methodologies for:
- Measuring Copilot adoption rates and user segmentation
- Identifying power users and building habit-based usage models
- Analyzing productivity impact and ROI of Copilot investments
- Creating executive dashboards for tracking deployment success
These analytics are based on behavioral research and provide actionable insights for maximizing your Copilot investment.
Quick Links
- Viva Insights official documentation
- vivainsights Python package
- vivainsights R package
- Copilot Analytics: Decoding Super Usage
- Copilot Analytics: advanced examples playbook
How to Use This Library
Browse the categories below to find sample code that matches your needs. Each script includes:
- Purpose: What the script accomplishes
- Prerequisites: Required packages and data formats
- Usage: How to run and customize the code
- Download: Direct link to the raw script file
Categories
-
π§ Essentials Essential utility functions and visualizations for getting started with Viva Insights analysis.
-
π Advanced Analytics Regression models, machine learning, and statistical analysis techniques.
-
π Network Analysis Collaboration network visualization and analysis scripts.
-
π€ Copilot Analytics Analysis and visualization scripts specifically for Microsoft Copilot usage data.
Contributing
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA). For details, visit Microsoft CLA.
License
This project is licensed under the MIT License - see the LICENSE file for details.