Tracking conversions

The conversion tracking allows you to track the behavior of visitors on your web site and adjust the web site for better results.

 

 

Tracking conversions in registration form, newsletter subscription and shopping cart

 

Kentico CMS comes with built-in support for tracking conversions in the following situations:

 

User registration

 

When the user registers, you can track it as a conversion by setting the value Track conversion name of the Registration form web part to some custom name - e.g. "registration".

 

Newsletter subscription

 

When the user registers, you can track it as a conversion by setting the value Track conversion name of the Newsletter subscription web part to some custom name - e.g. "subscription".

 

Purchase in the shopping cart

 

When the user registers or makes a purchase, you can track it as a conversion by setting the value Registration conversion name or Order conversion name of the Shopping cart web part to some custom name - e.g. "cart_registration" or "cart_order".

 

 

Tracking conversions and their campaign or referring web sites

 

If you wish to track the conversion together with campaign name or referring URL, you need to use the conversion name in the following format (for example):

 

order_{%campaign%}

or

order_{%urlreferrer%}

or

order_{%campaign%}_{%urlreferrer%}

 

 

Tracking conversions using your custom code

 

Using your custom code, you can track a conversion when a visitor makes some action on your web site, such as registration, sign up, etc. Then, you can see what changes made to the web site helped you increase your conversion rate.

 

To track a conversion, you need to add a piece of code to your page,  web part or to some global event handler:

 

[C#]

 

string siteName = CMS.CMSHelper.CMSContext.CurrentSiteName;

if (CMS.WebAnalytics.AnalyticsHelper.AnalyticsEnabled(siteName)

&& !CMS.WebAnalytics.AnalyticsHelper.IsIPExcluded(siteName, HttpContext.Current.Request.UserHostAddress))

{

  // log conversion, the conversion name is "order"

  CMS.WebAnalytics.HitLogProvider.LogHit("conversion", siteName, null, "order", 0);

}

 

Then, the conversion is tracked and you can see the statistics in the Conversions report.

 

You may want to use the following properties of the current user that provide information on the web site and/or campaign from which the user came:

 

[C#]

 

using CMS.CMSHelper;

 

// the following values provide the information from user's cookie

CMSContext.CurrentUser.URLReferrer //web site URL from which the visitor came

CMSContext.CurrentUser.Campaign //campaign from which the visitor came

 

// after the user registers, the information is available in the following database-stored values:

CMSContext.CurrentUser.UserURLReferrer //web site URL from which the visitor first came

CMSContext.CurrentUser.UserCampaign //campaign from which the visitor first came