Ejemplo n.º 1
0
        /// <summary>
        /// Decorates the HTML markup rendered by an Entity or Region View.
        /// </summary>
        /// <param name="htmlToDecorate">The HTML to decorate.</param>
        /// <param name="viewModel">The <see cref="ViewModel"/> associated with the HTML fragment.</param>
        /// <returns>The decorated HTML.</returns>
        public string DecorateMarkup(string htmlToDecorate, ViewModel viewModel)
        {
            SmartTargetExperiment experiment = viewModel as SmartTargetExperiment;
            if (experiment == null)
            {
                // Not a ST Experiment; nothing to do.
                return htmlToDecorate;
            }

            using (new Tracer(htmlToDecorate, viewModel))
            {
                if (_analyticsManager == null)
                {
                    // NOTE: might overwrite in a race condition, but that's not a problem.
                    _analyticsManager = new AnalyticsManager();
                }
                AnalyticsMetaData analyticsMetaData = new AnalyticsMetaData();
                return _analyticsManager.AddTrackingToLinks(htmlToDecorate, experiment.ExperimentDimensions, analyticsMetaData);
            }
        }
        /// <summary>
        /// Decorates the HTML markup rendered by an Entity or Region View.
        /// </summary>
        /// <param name="htmlToDecorate">The HTML to decorate.</param>
        /// <param name="viewModel">The <see cref="ViewModel"/> associated with the HTML fragment.</param>
        /// <returns>The decorated HTML.</returns>
        public string DecorateMarkup(string htmlToDecorate, ViewModel viewModel)
        {
            SmartTargetExperiment experiment = viewModel as SmartTargetExperiment;

            if (experiment == null)
            {
                // Not a ST Experiment; nothing to do.
                return(htmlToDecorate);
            }

            using (new Tracer(htmlToDecorate, viewModel))
            {
                if (_analyticsManager == null)
                {
                    // NOTE: might overwrite in a race condition, but that's not a problem.
                    _analyticsManager = new AnalyticsManager();
                }
                AnalyticsMetaData analyticsMetaData = new AnalyticsMetaData();
                return(_analyticsManager.AddTrackingToLinks(htmlToDecorate, experiment.ExperimentDimensions, analyticsMetaData));
            }
        }