Enabling marketing email tracking

When using email feeds, it is important to determine their overall effectiveness and optimize the individual marketing emails according to the results. You can achieve this by tracking the sent emails and monitoring the reactions of recipients. 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.

First, you need to enable on-line marketing if you want to use marketing email tracking for contact group recipients:

  1. Go to Settings -> On-line marketing.
  2. Ensure that the Enable on-line marketing setting is enabled for your website.
  3. Click Save.

Individual marketing emails have tracking enabled by default. You can check the configuration of individual email feeds:

  1. Open the Email marketing application on the Email feeds tab.
  2. Edit () an email campaign or a newsletter.
  3. Switch to the Configuration tab.
  4. Make sure that Track opened emails and Track clicked links are enabled.
  5. Click Save.

The system now measures the statistics of marketing emails sent to recipients.

Note

  • You cannot use tracking retroactively for emails that have already been sent before you enabled the settings.
  • The system does not include draft emails in the tracking statistics.
  • Two same URL paths (in a case-insensitive manner) are always represented by an identical tracking link.

Enabling email tracking in the live site application

Developers additionally need to enable processing of marketing email tracking requests on the side of the live site application. This allows email tracking to work even when the Xperience administration application is not publicly available.

The base URL of the tracking links uses the site’s Presentation URL and all settings related to email marketing that you configure in the administration application apply (both global settings and the configuration of individual email feeds).

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

  1. Open your MVC project in Visual Studio.

  2. Enable the email tracking feature by calling the UseEmailTracking method of the ApplicationBuilder instance.

    • Enable the feature at the start of your application’s life cycle, for example in the Application_Start method of your project’s Global.asax file.

      MVC projects created by the installer contain the ApplicationConfig class, whose RegisterFeatures method is called in the Application_Start method by default. You can use this class to encapsulate all of your ApplicationBuilder code (enabling and configuring of Xperience MVC features).

      Note: The feature must be enabled before you register routes into the application’s RouteTable. The Kentico().MapRoutes() method adds required routes based on the set of enabled features.

      
      
      
        using Kentico.Newsletters.Web.Mvc;
        using Kentico.Web.Mvc;
      
        ...
      
        protected void Application_Start()
        {
            ...
      
            // Gets the ApplicationBuilder instance
            // Allows you to enable and configure selected Xperience MVC integration features
            ApplicationBuilder builder = ApplicationBuilder.Current;
      
            // Enables the email tracking feature, registers the following routes by default:
            // "CMSModules/Newsletters/CMSPages/Track.ashx" route for opened marketing email tracking
            // "CMSModules/Newsletters/CMSPages/Redirect.ashx" route for clicked link tracking
            builder.UseEmailTracking();
      
            ...
        }
      
      
        
  1. Open your live site project in Visual Studio.

  2. Edit your application’s startup class (Startup.cs by default).

  3. Enable the email tracking feature by calling the UseEmailTracking method of the IFeaturesBuilder delegate passed to the IServiceCollection.AddKentico method within ConfigureServices.

    
    
    
     using Kentico.Newsletters.Web.Mvc;
     using Kentico.Web.Mvc;
    
     ...
    
     public void ConfigureServices(IServiceCollection services)
     {
         ...
         // Enables and configures Xperience features
         services.AddKentico(features =>
         {
             // Enables the email tracking feature, registers the following routes by default:
             // "CMSModules/Newsletters/CMSPages/Track.ashx" route for opened marketing email tracking
             // "CMSModules/Newsletters/CMSPages/Redirect.ashx" route for clicked link tracking
             features.UseEmailTracking();
             ... 
         });
    
         ...
     }
    
    
     

Enabling the UseEmailTracking feature ensures that the system registers routes that handle opened email and clicked link tracking requests

When a recipient opens an email or clicks a link in the content, the system automatically sends the tracking requests through the live site. The registered routes ensure that the tracking data is processed and logged into the Xperience database.

To manually disable tracking for a link in a marketing email:

  1. Open the Email marketingapplication on the Email feeds tab.
  2. Edit () an email campaign or a newsletter.
  3. On the Emails tab, edit an email that has not been sent yet.
  4. On the Content tab, click Source on the editor toolbar to switch to source mode.
  5. Insert the tracking=“false” attribute into the <a> tag of the given hyperlink.

For example: <a href=“https://www.kentico.com” tracking=“false”>Kentico</a>

In addition, tracking excludes the following links automatically:

  • Unsubscription links generated by the {% EmailFeed.UnsubscribeFromEmailFeedUrl %} expression (marketing emails keep separate unsubscription statistics by default)
  • Links to local anchors within the content of the email