WP Remix
Analytics for a New Generation

C# Code Example - Tracking events using the LogActivity method

[/REMIX
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NuConomy.Samples.SoapLogActivity
{
    class Program
    {
        static void Main(string[] args)
        {
            // Add a web service reference to https://services.nuconomy.com/ExternalServices.asmx

            // Create an instance of the NuConomy web service proxy
            services.nuconomy.com.ExternalServices NuConomyService = new NuConomy.Samples.SoapLogActivity.services.nuconomy.com.ExternalServices();

            // Create the object that will hold the data of the event you are tracking
            services.nuconomy.com.ExternalLogMessage eventToTrack = new NuConomy.Samples.SoapLogActivity.services.nuconomy.com.ExternalLogMessage();

            // Initilize the tracked event data
            eventToTrack.ProjectToken = "YourProjectToken";
            eventToTrack.ActivityId = 1;
            eventToTrack.LogActivityValue = 1;
            eventToTrack.ContentId = "TheContentId";
            eventToTrack.VisitorUserId = "LoggedInUserId";
            eventToTrack.ContentOwnerUserId = "ContentOwneruserId";

            try
            {
                // Call the NuConomy service
                NuConomyService.LogActivity(eventToTrack);
            }
            catch (Exception err)
            {
                Console.WriteLine("Error: " + err.Message);
            }
        }
    }
}

[REMIX]