Ejemplo n.º 1
0
        private void TrackAfterPayment(ReceiptViewModel model)
        {
            // Track Analytics
            GoogleAnalyticsTracking tracking = new GoogleAnalyticsTracking(ControllerContext.HttpContext);

            // Add the products
            int i = 1;

            foreach (OrderLineViewModel orderLine in model.Order.OrderLines)
            {
                if (string.IsNullOrEmpty(orderLine.Code) == false)
                {
                    tracking.ProductAdd(code: orderLine.Code,
                                        name: orderLine.Name,
                                        quantity: orderLine.Quantity,
                                        price: (double)orderLine.Price,
                                        position: i
                                        );
                    i++;
                }
            }

            // And the transaction itself
            tracking.Purchase(model.Order.OrderNumber,
                              null, (double)model.Order.TotalAmount, (double)model.Order.Tax, (double)model.Order.Shipping);
        }
Ejemplo n.º 2
0
        private void TrackBeforePayment(IEnumerable <LineItem> lineItems)
        {
            // Track Analytics.
            GoogleAnalyticsTracking tracking = new GoogleAnalyticsTracking(ControllerContext.HttpContext);

            // Add the products
            int i = 1;

            foreach (LineItem lineItem in lineItems)
            {
                tracking.ProductAdd(code: lineItem.Code,
                                    name: lineItem.Name,
                                    quantity: (int)lineItem.Quantity,
                                    price: (double)lineItem.PlacedPrice,
                                    position: i
                                    );
                i++;
            }

            // Step 3 is to pay
            tracking.Action("checkout", "{\"step\":3}");

            // Send it off
            tracking.Custom("ga('send', 'pageview');");
        }
        private void Track(List <Core.Objects.LineItem> lineItems)
        {
            // Track Analytics.
            GoogleAnalyticsTracking tracking = new GoogleAnalyticsTracking(ControllerContext.HttpContext);

            // Add the products
            int i = 1;

            foreach (Core.Objects.LineItem lineItem in lineItems)
            {
                tracking.ProductAdd(code: lineItem.Code,
                                    name: lineItem.Name,
                                    quantity: (int)lineItem.Quantity,
                                    price: (double)lineItem.PlacedPrice,
                                    position: i
                                    );
                i++;
            }

            // Step 2 is the checkout page
            tracking.Action("checkout", "{\"step\":2}");
        }
Ejemplo n.º 4
0
        protected void TrackAnalytics(DigitalCameraVariationViewModel viewModel)
        {
            // Track
            GoogleAnalyticsTracking tracking = new GoogleAnalyticsTracking(ControllerContext.HttpContext);

            tracking.ClearInteractions();

            // Track the main product view
            tracking.ProductAdd(
                viewModel.CatalogVariationContent.Code,
                viewModel.CatalogVariationContent.DisplayName,
                null,
                viewModel.CatalogVariationContent.Facet_Brand,
                null, null, 0,
                (double)viewModel.CatalogVariationContent.GetDefaultPriceAmount(_currentMarket.GetCurrentMarket()),
                0
                );

            // TODO: Track related products as impressions

            // Track action as details view
            tracking.Action("detail");
        }
Ejemplo n.º 5
0
        private void Track(CartModel model)
        {
            // Track Analytics.
            // TODO: Remove when GA add-in is fixed
            GoogleAnalyticsTracking tracking = new GoogleAnalyticsTracking(ControllerContext.HttpContext);

            // Add the products
            int i = 1;

            foreach (LineItem lineItem in model.LineItems)
            {
                tracking.ProductAdd(code: lineItem.Code,
                                    name: lineItem.DisplayName,
                                    quantity: (int)lineItem.Quantity,
                                    price: (double)lineItem.PlacedPrice,
                                    position: i
                                    );
                i++;
            }

            // Step 1 is to review the cart
            tracking.Action("checkout", "{\"step\":1}");
        }
Ejemplo n.º 6
0
        protected void TrackAnalytics(IVariationViewModel <GenericSizeVariationContent> viewModel)
        {
            // Track
            GoogleAnalyticsTracking tracking = new GoogleAnalyticsTracking(ControllerContext.HttpContext);

            tracking.ClearInteractions();

            // Track the main product view
            tracking.ProductAdd(
                viewModel.CatalogContent.Code,
                viewModel.CatalogContent.DisplayName,
                null,
                null,
                null,
                null,
                0,
                viewModel.CatalogContent.GetDefaultPriceAmountWholeNumber(_currentMarket.GetCurrentMarket()));

            // TODO: Track related products as impressions

            // Track action as details view
            tracking.Action("detail");
        }