You can use the email marketing features of Kentico with websites that are presented by a separate MVC application. 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 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.
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:
- Install the into your MVC project.
Edit the application's App_Start\RouteConfig.cs file.
- Add a using statement for the Kentico.Newsletters.Web.Mvc namespace.
Call predefined extension methods to register routes for the handling of opened email and clicked link tracking requests (typically inside the RegisterRoutes method).
using System.Web.Mvc; using System.Web.Routing; using Kentico.Web.Mvc; using Kentico.Newsletters.Web.Mvc;
// 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.
Was this page helpful?