Esempio n. 1
0
 public Experiment(GoogleExperiment experiment)
 {
     GoogleExperiment = experiment;
     if (TryParseUSplitExperimentName(experiment.Name, out var nodeId, out var name))
     {
         IsUSplitExperiment = true;
         Name          = name;
         ServerSide    = nodeId == -1;
         Configuration = ParseSettings(experiment.Description);
     }
Esempio n. 2
0
        private static List <Variation> ParseVariations(GoogleExperiment experiment)
        {
            //we might not be executing this in the scope of a http request
            var contentService = ApplicationContext.Current.Services.ContentService;
            var variations     = new List <Variation>();

            foreach (var variation in experiment.Variations)
            {
                IContent content = null;
                int      variationNodeId;
                if (int.TryParse(variation.Url, out variationNodeId))
                {
                    content = contentService.GetById(variationNodeId);
                }

                variations.Add(new Variation
                {
                    VariedContent   = content,
                    GoogleVariation = variation,
                });
            }
            return(variations);
        }
Esempio n. 3
0
        public static ManagementResource.ExperimentsResource.PatchRequest Patch(this ManagementResource.ExperimentsResource experiments, AnalyticsAccount config, GoogleExperiment experiment)
        {
            var accountId     = config.GoogleAccountId;
            var webPropertyId = config.GoogleWebPropertyId;
            var profileId     = config.GoogleProfileId;

            return(experiments.Patch(experiment, accountId, webPropertyId, profileId, experiment.Id));
        }
Esempio n. 4
0
 private void ParseGoogleData(GoogleExperiment experiment)
 {
     Configuration = ParseSettings(experiment.Description);
     Variations    = ParseVariations(experiment);
 }
Esempio n. 5
0
 public Experiment(GoogleExperiment experiment)
 {
     GoogleExperiment = experiment;
     ParseGoogleData(experiment);
 }
Esempio n. 6
0
        public static ManagementResource.ExperimentsResource.InsertRequest Insert(this ManagementResource.ExperimentsResource experiments, AccountConfig config, GoogleExperiment experiment)
        {
            var accountId     = config.GoogleAccountId;
            var webPropertyId = config.GoogleWebPropertyId;
            var profileId     = config.GoogleProfileId;

            return(experiments.Insert(experiment, accountId, webPropertyId, profileId));
        }