---
title: Tracking marketing emails on MVC sites
related:
  - https://docs.kentico.com/k11/on-line-marketing-features/managing-your-on-line-marketing-features/email-marketing/tracking-marketing-emails.md
  - https://docs.kentico.com/k11/developing-websites/developing-sites-using-asp-net-mvc/implementing-on-line-marketing-features-on-mvc-sites/email-marketing-on-mvc-sites/handling-newsletter-subscriptions-on-mvc-sites.md
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

You can use the [email marketing](https://docs.kentico.com/k11/on-line-marketing-features/managing-your-on-line-marketing-features/email-marketing.md) features of Kentico with websites that are presented by a [separate MVC application](https://docs.kentico.com/k11/developing-websites/developing-sites-using-asp-net-mvc.md). In this scenario, you manage and send marketing emails from the administration interface of the Kentico application. All settings related to email marketing that you configure in Kentico apply (both global settings and the configuration of individual email feeds).

When you have [tracking](https://docs.kentico.com/k11/on-line-marketing-features/managing-your-on-line-marketing-features/email-marketing/tracking-marketing-emails.md) enabled for an email feed (opened emails and clicked links), the system collects data by processing hidden image requests and link redirects. In standard scenarios, the Kentico application handles these tracking requests. For MVC scenarios, you need to register the email tracking functionality into the MVC application. This allows the email tracking to work even when the related Kentico application is not publicly available.

> **Note:** **Important**
>
> When you send out a marketing email, Kentico generates tracking links according to the type of the site containing the given email feed.
>
> - For standard sites, the tracking links target the handlers within the Kentico application itself.
> - For "Content only" sites (i.e. sites created using the _MVC Blank Site_ template), the base URL of the tracking links uses the site's _Presentation URL_.
>
> This means your site in Kentico _**must be marked as content only**_ if you wish to handle marketing email tracking on the side of the MVC website.

Perform the following steps to register email tracking functionality for your MVC application:

1. Install the  [Kentico.Newsletters.Web.Mvcintegration package](https://docs.kentico.com/k11/developing-websites/developing-sites-using-asp-net-mvc/starting-with-mvc-development/installing-kentico-integration-packages.md) into your MVC project.
2. Edit the application's _App\_Start\RouteConfig.cs_ file.

   1. Add a _using_ statement for the **Kentico.Newsletters.Web.Mvc** namespace.
   2. Call predefined extension methods to register routes for the handling of opened email and clicked link tracking requests (typically inside the **RegisterRoutes** method).

      ```csharp

      using System.Web.Mvc;
      using System.Web.Routing;

      using Kentico.Web.Mvc;
      using Kentico.Newsletters.Web.Mvc;


      ```

      ```csharp

                  // Maps routes used for tracking of marketing emails
                  // Registers the "CMSModules/Newsletters/CMSPages/Track.ashx" route for opened marketing email tracking
                  // Registers the "CMSModules/Newsletters/CMSPages/Redirect.ashx" route for clicked link tracking
                  routes.Kentico().MapOpenedEmailHandlerRoute();
                  routes.Kentico().MapEmailLinkHandlerRoute();


      ```

When a recipient opens an email or clicks a link in the content, the system automatically sends the tracking requests through the MVC site. The registered routes ensure that the tracking data is processed and logged into the shared Kentico database. From the point of view of the recipient reading the email, everything works the same way as when handling tracking through the Kentico application.
