Enabling activity tracking on MVC sites

Kentico EMS required

Features described on this page require the Kentico EMS license.

Activities represent actions that your contacts perform. For example, the system logs activities when visitors register as a member of a site or when visitors sign in to a site. The data gathered in the activity log allows you to evaluate the behavior of your website’s users and visitors. To learn more about activities, see Tracking contact activities.

Some activities are logged automatically when you enable tracking of contacts. However, certain activities require additional adjustments of your MVC application (see the table below).

Overview of activities supported in MVC

E-commerce

Product added to shopping cart

Logged automatically.

Product added to wishlist

Must be logged manually.

Product removed from shopping cart

Logged automatically.

Purchase

Logged automatically.

Purchased product

Logged automatically.

Shopping cart abandoned

Logged automatically.

Email marketing

Clicked link in marketing email

Logged automatically.

Opened marketing email

Logged automatically.

Subscription to a newsletter

Logged automatically.

Unsubscription from a single email feed

Logged automatically.

Opted out from all marketing emails

Logged automatically.

Membership

User login

Must be logged manually.

User registration

Must be logged manually.

Other

Form submission

Logged automatically.

Page

Landing page

Logged after adjusting your MVC application.

Page visit

Logged after adjusting your MVC application.

Search

External search

Logged after adjusting your MVC application.

Internal search

Must be logged manually.

For more information about logging of activities that require additional adjustments of your MVC application, see Logging activities on MVC sites.

  • To log the Landing page, Page visit, and External search activities, you need to explicitly enable the activity tracking feature for your MVC application (which registers routes that receive logging requests).

    The Landing page activity logging is affected by the CMSLandingPageLoaded cookie key, which expires after 20 minutes. The expiration period of the key is renewed every time the website is accessed again.

  • To log the User login, User registration, Product added to wishlist, and Internal search activities, you need to manually call a logging service in your own controllers.

Limitation: Because pages on MVC sites are not directly connected to pages from the Kentico content tree, activities are logged without a reference to the related Kentico page (i.e. the ActivityNodeID value is not assigned). For activities that occur on a specific page, such as Page visit or Landing page, the system logs the Activity URL value, which stores the live URL of the page on the MVC site.

Disabling activity logging for users

By default, the system tracks activities for all contacts. You can disable activity tracking for the user accounts of registered users.

  1. Open the Users application.
  2. Find and edit the given user account.
  3. Switch to the Settings tab.
  4. Disable the Log activities property.
  5. Click Save.

The activities performed by the registered user will no longer be recorded.

Configuring activity and contact update processing

When logging activities from MVC applications, the API does not ensure recalculation of contact scores, contact groups, personas and marketing automation triggers. For performance reasons, these recalculations are performed by the Kentico application.

Important

Because the Kentico application itself does not usually receive traffic from site visitors, you need to keep the application alive. For example, you can set the Start Mode advanced setting of the used application pool in IIS to AlwaysRunning.

By default, the system batch processes activities and contact detail updates every 10 seconds. You can configure the processing interval separately for the Kentico and MVC application. Adding the below key to the MVC application affects the interval at which logged activities and contact detail updates are saved from the memory into the database. Adding the below key to the Kentico application affects how often Kentico recalculates the data that could be affected by activities and contact updates.

If your system processes a large number of activities and contact updates, you may need to increase the default interval.

  1. Open your project’s web.config file.

  2. Add the following key into the appSettings section of the file. Increase the value to reflect how often you want the activities and contact updates to be processed.

    Processing activities and contact updates every 30 seconds
    
    
    
     <add key="CMSProcessContactActionsInterval" value="30" />
    
    
     
  3. Save the file.

The system now processes activities and contact detail updates in accordance with the configured intervals.