Sitecore Weekly Tips – Tip 8: kill sessions to quickly test your marketing automation campaigns

This is an old trick but a bit hard to find. I used this a lot when testing marketing automation scenario’s. Let’s say you have a marketing automation scenario which includes some emails and triggers like goal triggered or page visited. By default a session takes some time before it ends and the interaction data is written to the Experience Database. This makes testing scenarios a long process which requires a lot of patience. Something I do not have :).

So, to speed up the process you can create a little file, place it in the root of your Sitecore website and browse to it in your browser as soon as you want to end the session of your test user. Here is the code you can place in a file you can call something like kill.aspx or end.aspx or whatever you like:

<%@ Page Language="C#" AutoEventWireup="true" %>
<script runat="server">
public void Page_Load(object sender, EventArgs args)
{
 /*Sitecore.Analytics.Tracker.Current.EndVisit(false);
 Response.Write("visit ended");*/
 
 Session.Abandon();
}
</script>
<html>
 <body>
  <p>The session was abandoned.</p>
 </body>
</html>

If you start with EXM and marketing automation you will notice that you need this file. Walk through your scenario and call the file with http://www.yoursite.com/kill.aspx. Session ends, your user proceeds to the next steps in your marketing automation campaign.

Happy testing!