SlideShare una empresa de Scribd logo
1 de 12
EPiServer Usage Reports
As EPiServer projects age, it's not unusual to find content starting to stagnate certain page
types event used. At this stage it's wise to gather some reporting. This was the situation i
faced on a previous project.
It's possible to gather some information via EPiServer Admin and Reports section. However
if we want comprehensive information we too access EPiServer and create a custom report.
A feature that introduce in version 5.
Creating the Interface
Firstly, I need a web site where i can create the reports. Luckily EPiServer provides a couple
of options with the easiest being the new Alloy Demo Kit available from GitHub.
We have the option to create a Reports as a Web Forms ASPX page or a an MVC View. I've
chosen to use an ASPX page for its simplicity. To do this we simply need to create a ASPX
page, in Visual Studio. I would suggest you create a new folder under the modules , my
reasoning will become clear in a later post.
When creating the ASPX Page it's important to select Web Form without a MasterPage. We
will be assigning an EPiServer MasterPage, which needs to be done in code.
Next we need to replace the entire body with the code below, leaving only the first line
<%@ Page Language="C#" .
<asp:content contentplaceholderid="FullRegion" runat="Server">
<div class="epi-contentContainer epi-padding epi-contentArea">
<h1 class="EP-prefix">Report Heading</h1>
</div>
</asp:content>
Now we need to navigate to the code behind and update the class this page inherits,
from System.Web.UI.Page to EPiServer.Shell.WebForms.WebFormsBase .
Next we add the GuiPlugIn attribute, to tell EPiServer this is a Report and where it's located,
plus give it a friendly name.
[GuiPlugIn(Area = PlugInArea.ReportMenu,
DisplayName = "Page Types Usage Report",
Description = "Lists pages of a specific page type",
Category = "Usage Reports",
RequiredAccess = AccessLevel.Administer,
Url = "~/modules/UsageReports/PageTypeUsageReport.aspx")]
public partial class PageTypesUsageReport : WebFormsBase
Additional, with the Category property we can separate reports and withRequired
Access control access. how it should be listed in the Reports menu. The final step is to
override the OnPreInit method to set the master page.
protected override void OnPreInit(EventArgs e)
{
base.OnPreInit(e);
MasterPageFile =
UriSupport.ResolveUrlFromUIBySettings("MasterPages/EPiServerUI.master")
;
}
Now that we have a basic report we can look into populating it.
Populating the report
Our first task is to override the OnLoad method, that will contain our logic. We could have
used the 'PageLoad' methods and participate in the AutoEventWireup. However, as a rule
set I AutoEventWireup="false" and delete the 'PageLoad' methods for performance
reasons. Additional I've added a Property to hold all the
public IEnumerable<ContentTypeUsageVm> ReportItems { get; private set;
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
First we need to get a copy an instance of the PageTypeRepository , we can
use ServiceLocator to do this.
Then we simple call the List method to return all the pages. I've also added a simple property
which will to generate the HTML.
var serviceLocator = ServiceLocator.Current;
var pageTypeRepo =
serviceLocator.GetInstance<IContentTypeRepository>();
ReportsItems = from contentType in contentTypeRepo.List()
select new ContentTypeUsageVm {
ContentTypeName = contentType.Name,
Available = contentType.IsAvailable,
Description = contentType.Description
};
}
If we require any Web Form Controls that use the uses the view state we also need to
set EnableViewState="true" on the <%@ Page declaration.
<% if (ReportItems != null && ReportItems.Any())
{ %> <table>
<thead>
<tr>
<th>
Page Type
</th>
<th>
Available
</th>
<th>
Description
</th>
</tr>
</thead>
<% foreach (var item in ReportItems)
{ %>
<tbody>
<tr>
<td><%= item.ContentTypeName %></td>
<td><%= item.Available %></td>
<td><%= item.Description %></td>
</tr>
</tbody>
<% } %>
</table>
<% } %>
This will give us a basic report, however i won't tell us about usage, for this we need to do
some additional work.
Generating Usage Data
We need to introduce two new services. IContentModelUsage returns reference to content
thats implements a particular types andIContentRepository for loading the content. By
combining both these services we can generate some sensible usage data.
//insert code below the IContentTypeRepository and replace lines 5-8.
var contentUsage = serviceLocator.GetInstance<IContentModelUsage>();
var contentRepo = serviceLocator.GetInstance<IContentRepository>();
ReportsItems = from contentType in contentTypeRepo.List()
let usage = from u in contentUsage
.ListContentOfContentType(contentType)
select u.ContentLink
.ToReferenceWithoutVersion()).Distinct())
let content = contentRepo.GetItems(usage
, LanguageSelector.AutoDetect())
let pages = usage.OfType<PageData>()
select new ContentTypeUsageVM {
Total = usage.Count(),
Deleted = content.Count(p => p.IsDeleted),
To get the number of times content of a type has been created, we only need to count the
usages references with versions removed. More detailed information will require us to load
the content data.
With the Content Repository we can load the list of IContent from the content references.
This gives us access IsDelete Property, however for more information we must cast the back
into it's base type, PageData, BlockData or MediaData.
Whats next
Now that I've create one report, i now create multiple reports to cover all my needs. Next i
need to extract these reports into a separate project and upload it to GitHub. My finial task
will be to create a Nuget package. This final task will become my next blog entry.
Resources
CreatevYour Own Reports in the New Report Center
Iintroducing Alloy demo kit

Más contenido relacionado

La actualidad más candente (18)

Lecture Slides for List Views [Android ]
Lecture Slides for List Views [Android ]Lecture Slides for List Views [Android ]
Lecture Slides for List Views [Android ]
 
Redux in Angular2 for jsbe
Redux in Angular2 for jsbeRedux in Angular2 for jsbe
Redux in Angular2 for jsbe
 
Angular js
Angular jsAngular js
Angular js
 
Asp.net page lifecycle
Asp.net page lifecycleAsp.net page lifecycle
Asp.net page lifecycle
 
Rails introduction
Rails introductionRails introduction
Rails introduction
 
Introduction to Handoff
Introduction to HandoffIntroduction to Handoff
Introduction to Handoff
 
Life cycle of web page
Life cycle of web pageLife cycle of web page
Life cycle of web page
 
11 asp.net session16
11 asp.net session1611 asp.net session16
11 asp.net session16
 
List Views
List ViewsList Views
List Views
 
Hilt Annotations
Hilt AnnotationsHilt Annotations
Hilt Annotations
 
05.SharePointCSOM
05.SharePointCSOM05.SharePointCSOM
05.SharePointCSOM
 
ASP.NET Page Life Cycle
ASP.NET Page Life CycleASP.NET Page Life Cycle
ASP.NET Page Life Cycle
 
Dash of ajax
Dash of ajaxDash of ajax
Dash of ajax
 
Beginner’s tutorial (part 1) integrate redux form in react native application
Beginner’s tutorial (part 1) integrate redux form in react native applicationBeginner’s tutorial (part 1) integrate redux form in react native application
Beginner’s tutorial (part 1) integrate redux form in react native application
 
Android list view tutorial by Javatechig
Android list view tutorial by JavatechigAndroid list view tutorial by Javatechig
Android list view tutorial by Javatechig
 
RichControl in Asp.net
RichControl in Asp.netRichControl in Asp.net
RichControl in Asp.net
 
03 asp.net session04
03 asp.net session0403 asp.net session04
03 asp.net session04
 
Creating web api and consuming- part 1
Creating web api and consuming- part 1Creating web api and consuming- part 1
Creating web api and consuming- part 1
 

Destacado

CORMA-FW REPRINT-APR2015
CORMA-FW REPRINT-APR2015CORMA-FW REPRINT-APR2015
CORMA-FW REPRINT-APR2015Jörn Weber
 
Revista prob. apdzje.
Revista prob. apdzje.Revista prob. apdzje.
Revista prob. apdzje.Alvaro Rojo
 
&lt;iframe height="400" width="476" src="https://www.slideshare.net/slideshow...
&lt;iframe height="400" width="476" src="https://www.slideshare.net/slideshow...&lt;iframe height="400" width="476" src="https://www.slideshare.net/slideshow...
&lt;iframe height="400" width="476" src="https://www.slideshare.net/slideshow...Martine Promess
 
Vicious&amp;virtuous circle of poor infrastructure and odm
Vicious&amp;virtuous circle of poor infrastructure and odmVicious&amp;virtuous circle of poor infrastructure and odm
Vicious&amp;virtuous circle of poor infrastructure and odmthisisizu
 
Okaydriving flyer
Okaydriving flyerOkaydriving flyer
Okaydriving flyerRasch Drums
 
Code syntax highlighting in ghost
Code syntax highlighting in ghostCode syntax highlighting in ghost
Code syntax highlighting in ghostPaul Graham
 
Sorteo de grupos mundial Brasil 2014
Sorteo de grupos mundial Brasil 2014Sorteo de grupos mundial Brasil 2014
Sorteo de grupos mundial Brasil 2014ericsocias
 
Microprocessor 8086 and Microcontoller
Microprocessor 8086 and MicrocontollerMicroprocessor 8086 and Microcontoller
Microprocessor 8086 and MicrocontollerSaad Tanvir
 
Habeas corpus por Milagro Sala
Habeas corpus por Milagro SalaHabeas corpus por Milagro Sala
Habeas corpus por Milagro SalaUnidiversidad
 
Open Source Recipes for Chef Deployments of Hadoop
Open Source Recipes for Chef Deployments of HadoopOpen Source Recipes for Chef Deployments of Hadoop
Open Source Recipes for Chef Deployments of HadoopDataWorks Summit
 
The Age of Data Driven Science and Engineering
The Age of Data Driven Science and Engineering The Age of Data Driven Science and Engineering
The Age of Data Driven Science and Engineering Persontyle
 
Social Media Intelligence: The Basics
Social Media Intelligence: The BasicsSocial Media Intelligence: The Basics
Social Media Intelligence: The BasicsJessica Thomas
 
Evolucion del tamaño y las areas funcionales del cerebro humano
Evolucion del tamaño y las areas funcionales del cerebro humano Evolucion del tamaño y las areas funcionales del cerebro humano
Evolucion del tamaño y las areas funcionales del cerebro humano Cristian Castañeda Quiceno
 
Afib and Stroke Prevention Update
Afib and Stroke Prevention UpdateAfib and Stroke Prevention Update
Afib and Stroke Prevention UpdateJose Osorio
 
tipos de denticion
tipos de denticiontipos de denticion
tipos de denticionvanessami
 

Destacado (20)

CORMA-FW REPRINT-APR2015
CORMA-FW REPRINT-APR2015CORMA-FW REPRINT-APR2015
CORMA-FW REPRINT-APR2015
 
Informe plagio
Informe plagioInforme plagio
Informe plagio
 
Revista prob. apdzje.
Revista prob. apdzje.Revista prob. apdzje.
Revista prob. apdzje.
 
&lt;iframe height="400" width="476" src="https://www.slideshare.net/slideshow...
&lt;iframe height="400" width="476" src="https://www.slideshare.net/slideshow...&lt;iframe height="400" width="476" src="https://www.slideshare.net/slideshow...
&lt;iframe height="400" width="476" src="https://www.slideshare.net/slideshow...
 
Vicious&amp;virtuous circle of poor infrastructure and odm
Vicious&amp;virtuous circle of poor infrastructure and odmVicious&amp;virtuous circle of poor infrastructure and odm
Vicious&amp;virtuous circle of poor infrastructure and odm
 
Okaydriving flyer
Okaydriving flyerOkaydriving flyer
Okaydriving flyer
 
Code syntax highlighting in ghost
Code syntax highlighting in ghostCode syntax highlighting in ghost
Code syntax highlighting in ghost
 
Sorteo de grupos mundial Brasil 2014
Sorteo de grupos mundial Brasil 2014Sorteo de grupos mundial Brasil 2014
Sorteo de grupos mundial Brasil 2014
 
Joe McNally
Joe McNallyJoe McNally
Joe McNally
 
Microprocessor 8086 and Microcontoller
Microprocessor 8086 and MicrocontollerMicroprocessor 8086 and Microcontoller
Microprocessor 8086 and Microcontoller
 
Habeas corpus por Milagro Sala
Habeas corpus por Milagro SalaHabeas corpus por Milagro Sala
Habeas corpus por Milagro Sala
 
Kazakhstan Innovations
Kazakhstan InnovationsKazakhstan Innovations
Kazakhstan Innovations
 
Open Source Recipes for Chef Deployments of Hadoop
Open Source Recipes for Chef Deployments of HadoopOpen Source Recipes for Chef Deployments of Hadoop
Open Source Recipes for Chef Deployments of Hadoop
 
The Age of Data Driven Science and Engineering
The Age of Data Driven Science and Engineering The Age of Data Driven Science and Engineering
The Age of Data Driven Science and Engineering
 
Social Media Intelligence: The Basics
Social Media Intelligence: The BasicsSocial Media Intelligence: The Basics
Social Media Intelligence: The Basics
 
Evolucion del tamaño y las areas funcionales del cerebro humano
Evolucion del tamaño y las areas funcionales del cerebro humano Evolucion del tamaño y las areas funcionales del cerebro humano
Evolucion del tamaño y las areas funcionales del cerebro humano
 
ενα παραθυρο ανοιχτο
ενα παραθυρο ανοιχτοενα παραθυρο ανοιχτο
ενα παραθυρο ανοιχτο
 
Analisis De Cargos
Analisis De CargosAnalisis De Cargos
Analisis De Cargos
 
Afib and Stroke Prevention Update
Afib and Stroke Prevention UpdateAfib and Stroke Prevention Update
Afib and Stroke Prevention Update
 
tipos de denticion
tipos de denticiontipos de denticion
tipos de denticion
 

Similar a Creating EPiServer Usage Reports

How to embed reporting into your asp.net core web applications
How to embed reporting into your asp.net core web applications How to embed reporting into your asp.net core web applications
How to embed reporting into your asp.net core web applications Concetto Labs
 
Django 1.10.3 Getting started
Django 1.10.3 Getting startedDjango 1.10.3 Getting started
Django 1.10.3 Getting startedMoniaJ
 
Fr net programmermanual-en
Fr net programmermanual-enFr net programmermanual-en
Fr net programmermanual-enMorenita Batista
 
How to build integrated, professional enterprise-grade cross-platform mobile ...
How to build integrated, professional enterprise-grade cross-platform mobile ...How to build integrated, professional enterprise-grade cross-platform mobile ...
How to build integrated, professional enterprise-grade cross-platform mobile ...Appear
 
Demo Guidebook 040110
Demo Guidebook 040110Demo Guidebook 040110
Demo Guidebook 040110Brad Ganas
 
Enterprise Level Application Architecture with Web APIs using Entity Framewor...
Enterprise Level Application Architecture with Web APIs using Entity Framewor...Enterprise Level Application Architecture with Web APIs using Entity Framewor...
Enterprise Level Application Architecture with Web APIs using Entity Framewor...Akhil Mittal
 
.NET Portfolio
.NET Portfolio.NET Portfolio
.NET Portfoliomwillmer
 
Adding custom ui controls to your application (1)
Adding custom ui controls to your application (1)Adding custom ui controls to your application (1)
Adding custom ui controls to your application (1)Oro Inc.
 
The ActionScript Conference 08, Singapore - Developing ActionScript 3 Mash up...
The ActionScript Conference 08, Singapore - Developing ActionScript 3 Mash up...The ActionScript Conference 08, Singapore - Developing ActionScript 3 Mash up...
The ActionScript Conference 08, Singapore - Developing ActionScript 3 Mash up...marcocasario
 
15 asp.net session22
15 asp.net session2215 asp.net session22
15 asp.net session22Vivek chan
 
Resolve dependency of dependencies using Inversion of Control and dependency ...
Resolve dependency of dependencies using Inversion of Control and dependency ...Resolve dependency of dependencies using Inversion of Control and dependency ...
Resolve dependency of dependencies using Inversion of Control and dependency ...Akhil Mittal
 
770_0629.pdf dump for oracle cloud interface
770_0629.pdf dump for oracle cloud interface770_0629.pdf dump for oracle cloud interface
770_0629.pdf dump for oracle cloud interfacelknam1982
 
Inversion of control using dependency injection in Web APIs using Unity Conta...
Inversion of control using dependency injection in Web APIs using Unity Conta...Inversion of control using dependency injection in Web APIs using Unity Conta...
Inversion of control using dependency injection in Web APIs using Unity Conta...Akhil Mittal
 
Parallelminds.asp.net with sp
Parallelminds.asp.net with spParallelminds.asp.net with sp
Parallelminds.asp.net with spparallelminder
 
using Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API'susing Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API'sAntônio Roberto Silva
 
Aspnet mvc tutorial_01_cs
Aspnet mvc tutorial_01_csAspnet mvc tutorial_01_cs
Aspnet mvc tutorial_01_csAlfa Gama Omega
 
Inside WSS sample shots
Inside WSS sample shotsInside WSS sample shots
Inside WSS sample shotsSøren Raarup
 

Similar a Creating EPiServer Usage Reports (20)

How to embed reporting into your asp.net core web applications
How to embed reporting into your asp.net core web applications How to embed reporting into your asp.net core web applications
How to embed reporting into your asp.net core web applications
 
Django 1.10.3 Getting started
Django 1.10.3 Getting startedDjango 1.10.3 Getting started
Django 1.10.3 Getting started
 
Fr net programmermanual-en
Fr net programmermanual-enFr net programmermanual-en
Fr net programmermanual-en
 
How to build integrated, professional enterprise-grade cross-platform mobile ...
How to build integrated, professional enterprise-grade cross-platform mobile ...How to build integrated, professional enterprise-grade cross-platform mobile ...
How to build integrated, professional enterprise-grade cross-platform mobile ...
 
Demo Guidebook 040110
Demo Guidebook 040110Demo Guidebook 040110
Demo Guidebook 040110
 
Enterprise Level Application Architecture with Web APIs using Entity Framewor...
Enterprise Level Application Architecture with Web APIs using Entity Framewor...Enterprise Level Application Architecture with Web APIs using Entity Framewor...
Enterprise Level Application Architecture with Web APIs using Entity Framewor...
 
.NET Portfolio
.NET Portfolio.NET Portfolio
.NET Portfolio
 
ASP.NET Identity
ASP.NET IdentityASP.NET Identity
ASP.NET Identity
 
Web forms in ASP.net
Web forms in ASP.netWeb forms in ASP.net
Web forms in ASP.net
 
Adding custom ui controls to your application (1)
Adding custom ui controls to your application (1)Adding custom ui controls to your application (1)
Adding custom ui controls to your application (1)
 
The ActionScript Conference 08, Singapore - Developing ActionScript 3 Mash up...
The ActionScript Conference 08, Singapore - Developing ActionScript 3 Mash up...The ActionScript Conference 08, Singapore - Developing ActionScript 3 Mash up...
The ActionScript Conference 08, Singapore - Developing ActionScript 3 Mash up...
 
15 asp.net session22
15 asp.net session2215 asp.net session22
15 asp.net session22
 
Resolve dependency of dependencies using Inversion of Control and dependency ...
Resolve dependency of dependencies using Inversion of Control and dependency ...Resolve dependency of dependencies using Inversion of Control and dependency ...
Resolve dependency of dependencies using Inversion of Control and dependency ...
 
770_0629.pdf dump for oracle cloud interface
770_0629.pdf dump for oracle cloud interface770_0629.pdf dump for oracle cloud interface
770_0629.pdf dump for oracle cloud interface
 
Inversion of control using dependency injection in Web APIs using Unity Conta...
Inversion of control using dependency injection in Web APIs using Unity Conta...Inversion of control using dependency injection in Web APIs using Unity Conta...
Inversion of control using dependency injection in Web APIs using Unity Conta...
 
Parallelminds.asp.net with sp
Parallelminds.asp.net with spParallelminds.asp.net with sp
Parallelminds.asp.net with sp
 
using Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API'susing Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API's
 
Aspnet mvc tutorial_01_cs
Aspnet mvc tutorial_01_csAspnet mvc tutorial_01_cs
Aspnet mvc tutorial_01_cs
 
NET_Training.pptx
NET_Training.pptxNET_Training.pptx
NET_Training.pptx
 
Inside WSS sample shots
Inside WSS sample shotsInside WSS sample shots
Inside WSS sample shots
 

Más de Paul Graham

Publising a nuget package
Publising a nuget packagePublising a nuget package
Publising a nuget packagePaul Graham
 
EPiServer report generation
EPiServer report generationEPiServer report generation
EPiServer report generationPaul Graham
 
A guide to EPiServer CMS Scheduled Job
A guide to EPiServer CMS Scheduled JobA guide to EPiServer CMS Scheduled Job
A guide to EPiServer CMS Scheduled JobPaul Graham
 
Creating an nuget package for EPiServer
Creating an nuget package for EPiServerCreating an nuget package for EPiServer
Creating an nuget package for EPiServerPaul Graham
 
Adding disqus to ghost blog
Adding disqus to ghost blogAdding disqus to ghost blog
Adding disqus to ghost blogPaul Graham
 
Entity framework (EF) 7
Entity framework (EF) 7Entity framework (EF) 7
Entity framework (EF) 7Paul Graham
 

Más de Paul Graham (7)

Publising a nuget package
Publising a nuget packagePublising a nuget package
Publising a nuget package
 
EPiServer report generation
EPiServer report generationEPiServer report generation
EPiServer report generation
 
A guide to EPiServer CMS Scheduled Job
A guide to EPiServer CMS Scheduled JobA guide to EPiServer CMS Scheduled Job
A guide to EPiServer CMS Scheduled Job
 
Creating an nuget package for EPiServer
Creating an nuget package for EPiServerCreating an nuget package for EPiServer
Creating an nuget package for EPiServer
 
Adding disqus to ghost blog
Adding disqus to ghost blogAdding disqus to ghost blog
Adding disqus to ghost blog
 
C# 6.0
C# 6.0C# 6.0
C# 6.0
 
Entity framework (EF) 7
Entity framework (EF) 7Entity framework (EF) 7
Entity framework (EF) 7
 

Último

Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 

Último (20)

Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 

Creating EPiServer Usage Reports

  • 1. EPiServer Usage Reports As EPiServer projects age, it's not unusual to find content starting to stagnate certain page types event used. At this stage it's wise to gather some reporting. This was the situation i faced on a previous project. It's possible to gather some information via EPiServer Admin and Reports section. However if we want comprehensive information we too access EPiServer and create a custom report. A feature that introduce in version 5.
  • 2. Creating the Interface Firstly, I need a web site where i can create the reports. Luckily EPiServer provides a couple of options with the easiest being the new Alloy Demo Kit available from GitHub.
  • 3. We have the option to create a Reports as a Web Forms ASPX page or a an MVC View. I've chosen to use an ASPX page for its simplicity. To do this we simply need to create a ASPX page, in Visual Studio. I would suggest you create a new folder under the modules , my reasoning will become clear in a later post. When creating the ASPX Page it's important to select Web Form without a MasterPage. We will be assigning an EPiServer MasterPage, which needs to be done in code.
  • 4. Next we need to replace the entire body with the code below, leaving only the first line <%@ Page Language="C#" . <asp:content contentplaceholderid="FullRegion" runat="Server"> <div class="epi-contentContainer epi-padding epi-contentArea"> <h1 class="EP-prefix">Report Heading</h1> </div> </asp:content> Now we need to navigate to the code behind and update the class this page inherits, from System.Web.UI.Page to EPiServer.Shell.WebForms.WebFormsBase .
  • 5. Next we add the GuiPlugIn attribute, to tell EPiServer this is a Report and where it's located, plus give it a friendly name. [GuiPlugIn(Area = PlugInArea.ReportMenu, DisplayName = "Page Types Usage Report", Description = "Lists pages of a specific page type", Category = "Usage Reports", RequiredAccess = AccessLevel.Administer, Url = "~/modules/UsageReports/PageTypeUsageReport.aspx")] public partial class PageTypesUsageReport : WebFormsBase Additional, with the Category property we can separate reports and withRequired Access control access. how it should be listed in the Reports menu. The final step is to override the OnPreInit method to set the master page.
  • 6. protected override void OnPreInit(EventArgs e) { base.OnPreInit(e); MasterPageFile = UriSupport.ResolveUrlFromUIBySettings("MasterPages/EPiServerUI.master") ; } Now that we have a basic report we can look into populating it.
  • 7. Populating the report Our first task is to override the OnLoad method, that will contain our logic. We could have used the 'PageLoad' methods and participate in the AutoEventWireup. However, as a rule set I AutoEventWireup="false" and delete the 'PageLoad' methods for performance reasons. Additional I've added a Property to hold all the public IEnumerable<ContentTypeUsageVm> ReportItems { get; private set; } protected override void OnLoad(EventArgs e) { base.OnLoad(e); First we need to get a copy an instance of the PageTypeRepository , we can use ServiceLocator to do this.
  • 8. Then we simple call the List method to return all the pages. I've also added a simple property which will to generate the HTML. var serviceLocator = ServiceLocator.Current; var pageTypeRepo = serviceLocator.GetInstance<IContentTypeRepository>(); ReportsItems = from contentType in contentTypeRepo.List() select new ContentTypeUsageVm { ContentTypeName = contentType.Name, Available = contentType.IsAvailable, Description = contentType.Description }; }
  • 9. If we require any Web Form Controls that use the uses the view state we also need to set EnableViewState="true" on the <%@ Page declaration. <% if (ReportItems != null && ReportItems.Any()) { %> <table> <thead> <tr> <th> Page Type </th> <th> Available </th> <th> Description </th> </tr> </thead> <% foreach (var item in ReportItems) { %>
  • 10. <tbody> <tr> <td><%= item.ContentTypeName %></td> <td><%= item.Available %></td> <td><%= item.Description %></td> </tr> </tbody> <% } %> </table> <% } %> This will give us a basic report, however i won't tell us about usage, for this we need to do some additional work.
  • 11. Generating Usage Data We need to introduce two new services. IContentModelUsage returns reference to content thats implements a particular types andIContentRepository for loading the content. By combining both these services we can generate some sensible usage data. //insert code below the IContentTypeRepository and replace lines 5-8. var contentUsage = serviceLocator.GetInstance<IContentModelUsage>(); var contentRepo = serviceLocator.GetInstance<IContentRepository>(); ReportsItems = from contentType in contentTypeRepo.List() let usage = from u in contentUsage .ListContentOfContentType(contentType) select u.ContentLink .ToReferenceWithoutVersion()).Distinct()) let content = contentRepo.GetItems(usage , LanguageSelector.AutoDetect()) let pages = usage.OfType<PageData>() select new ContentTypeUsageVM { Total = usage.Count(),
  • 12. Deleted = content.Count(p => p.IsDeleted), To get the number of times content of a type has been created, we only need to count the usages references with versions removed. More detailed information will require us to load the content data. With the Content Repository we can load the list of IContent from the content references. This gives us access IsDelete Property, however for more information we must cast the back into it's base type, PageData, BlockData or MediaData. Whats next Now that I've create one report, i now create multiple reports to cover all my needs. Next i need to extract these reports into a separate project and upload it to GitHub. My finial task will be to create a Nuget package. This final task will become my next blog entry. Resources CreatevYour Own Reports in the New Report Center Iintroducing Alloy demo kit