Skip to content

Advanced setup

Dennis Heutinck edited this page Oct 9, 2022 · 1 revision

You can manually setup the URL Tracker for maximum customisability.

Complete manual setup

For a complete manual setup, you need to reference the following packages:

  • UrlTracker.Backoffice.Notifications
  • UrlTracker.Backoffice.UI
  • UrlTracker.Core
  • UrlTracker.Core.Caching.Memory
  • UrlTracker.Middleware
  • UrlTracker.Web

for manual setup, DO NOT REFERENCE UrlTracker. That package automatically registers all features in the service container.

You'll have to include the services to your project startup.cs or add a composer to your project like this:

using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.DependencyInjection;
using UrlTracker.Backoffice.Notifications;
using UrlTracker.Backoffice.UI;
using UrlTracker.Core;
using UrlTracker.Core.Caching.Memory;
using UrlTracker.Middleware;
using UrlTracker.Web;

namespace MyProject
{
    public class UrlTrackerComposer : IComposer
    {
        public void Compose(IUmbracoBuilder builder)
        {
            builder
                .ComposeUrlTrackerCore()                    // Add core services
                .ComposeUrlTrackerWeb()                     // Add http services
                .ComposeUrlTrackerMemoryCache()             // Add memory cache layer to core services
                .ComposeUrlTrackerBackoffice()              // Add backoffice dashboard
                .ComposeUrlTrackerBackofficeNotifications() // Add content change tracking
                .ComposeUrlTrackerMiddleware();             // Add request redirecting and client error tracking
        }
    }
}

You might for example want to do this if:

  1. You want to replace the in-memory cache implementation for a distributed cache implementation of your own. In that case you'd omit the call to .ComposeUrlTrackerMemoryCache().
  2. You are not interested in tracking content changes in the backoffice. In that case you'd omit the call to .ComposeUrlTrackerBackofficeNotifications().

You can exclude any feature from your composer that you don't want to have by simply omitting the method call from your composer. Keep in mind that some services may rely on the presence of services from other packages. Check out the following table for dependencies

Features

Extension Package Must be invoked after Description
ComposeUrlTrackerCore UrlTracker.Core nothing Adds core api for managing redirects and client errors. Includes database migrations
ComposeUrlTrackerWeb UrlTracker.Web ComposeUrlTrackerCore Adds default http services for handling requests. Does not actually handle the request
ComposeUrlTrackerMemoryCache UrlTracker.Core.Cache.Memory ComposeUrlTrackerCore Adds simple in-memory caching layers to the core api for improved performance.
ComposeUrlTrackerBackoffice UrlTracker.Backoffice.UI ComposeUrlTrackerCore Adds and configures the dashboard in the Umbraco backoffice
ComposeUrlTrackerBackofficeNotifications UrlTracker.Backoffice.Notifications ComposeUrlTrackerCore Adds tracking of content changes and automatic creation of redirects
ComposeUrlTrackerMiddleware UrlTracker.Middleware ComposeUrlTrackerWeb Adds middlewares that handle incoming requests based on the redirects that are configured in the core api
Clone this wiki locally