Example #1
0
        [HttpGet] // should be a post, but keeping demo simple
        public ActionResult Buy(int visitorId, int productId)
        {
            // buy the item (record the conversion)
            var visitor = VisitorRepo.Single(v => v.Id == visitorId);

            Entity.EventTags eventTags = new Entity.EventTags()
            {
                { "int_param", 4242 },
                { "string_param", "4242" },
                { "bool_param", true },
                { "revenue", 1337 },
                { "value", 100 }
            };
            Optimizely.Track("AddToCart", Convert.ToString(visitorId), visitor.GetUserAttributes(), eventTags);
            TempData["Message"] = string.Format("Successfully Purchased item {0} for visitor {1}", productId, visitorId);

            return(RedirectToAction("Shop"));
        }
 public void TestTrack(TrackParams parameters)
 {
     OptimizelyClient.Track(parameters.EventKey, parameters.UserId, parameters.UserAttributes, parameters.EventTags);
 }