public override void Execute(INotification notification)
        {
            // Get AnalyticsProxy
            analyticsProxy = Facade.RetrieveProxy(AnalyticsProxy.NAME) as AnalyticsProxy;

            // Check incoming eventData

            if (!(notification.Body is AnalyticsEvent analyticsEvent))
            {
                Debug.LogWarning("Could not process analytics Event");
                return;
            }

            // Store event in pending list
            analyticsProxy.AddEvent(analyticsEvent);

            // Check if it is appropriate to push events to server
            if (DateTime.Now >= analyticsProxy.GetNextServerPushTime())
            {
                // Start coroutine to push to server via UnityWebRequest
                Facade.SendNotification(CoreNote.REQUEST_START_COROUTINE, new RequestStartCoroutineVO
                {
                    coroutine = Upload(analyticsProxy.GetPendingEventsAsEncodedString())
                });
            }
        }
Exemplo n.º 2
0
        public override void Execute(INotification notification)
        {
            DebugLogger.Log("RequestSetAnalyticsBaseURLCommand::Execute");

            // Get AnalyticsProxy
            AnalyticsProxy analyticsProxy = Facade.RetrieveProxy(AnalyticsProxy.NAME) as AnalyticsProxy;

            analyticsProxy.APIBaseURL = notification.Body.ToString();
        }
Exemplo n.º 3
0
        public override void Execute(INotification notification)
        {
            DebugLogger.Log("RequestPushAllPendingEvents::Execute");

            // Get AnalyticsProxy
            analyticsProxy = Facade.RetrieveProxy(AnalyticsProxy.NAME) as AnalyticsProxy;

            Upload(analyticsProxy.GetPendingEventsAsEncodedString());
        }
Exemplo n.º 4
0
        public List <String> getProfileIdList()
        {
            try
            {
                List <String>            profilesIdList = new List <String>();
                GDataGAuthRequestFactory requestFactory = new GDataGAuthRequestFactory("analytics", "GTGATracker");
                requestFactory.AccountType = "GOOGLE";
                AnalyticsProxy             = new AnalyticsProxy(requestFactory);
                this.RequestFactory        = requestFactory;
                this.setUserCredentials(GetEmail(), GetPassword());
                string        queri           = ConfigurationManager.AppSettings["FeedAccountsUri"] + ConfigurationManager.AppSettings["API_Key"];
                string        webProfileId    = "";
                string        webPropertie    = "";
                string        profileIdUrl    = "";
                List <String> webProfilesList = new List <String>();
                List <String> idList          = new List <String>();
                DataQuery     query           = new DataQuery(queri);
                DataFeed      feedWebProperty = this.Query(query);
                foreach (AtomEntry entry in feedWebProperty.Entries)
                {
                    webProfileId = entry.Links[1].HRef.Content;
                    DataQuery propertyQuery = new DataQuery(webProfileId);
                    DataFeed  feedProfile   = this.Query(propertyQuery);
                    foreach (DataEntry entri in feedProfile.Entries)
                    {
                        webPropertie = entri.Links[2].HRef.Content;
                        DataQuery profileIdQuery = new DataQuery(webPropertie);
                        DataFeed  feedProfileId  = this.Query(profileIdQuery);
                        foreach (DataEntry entrie in feedProfileId.Entries)
                        {
                            idList.Add(entrie.Links[0].HRef.Content);
                            profileIdUrl = entrie.Links[0].HRef.Content;
                        }
                    }
                }

                return(idList);
            }
            catch (GDataRequestException e)
            {
                throw e;
            }
        }
Exemplo n.º 5
0
        public DataFeed GetStatistics(String profile, GtQueryDetails details)
        {
            try
            {
                RequestSettings  settings = new RequestSettings("GTGATracker");
                AnalyticsRequest request  = new AnalyticsRequest(settings);
                request.Service = this;
                AnalyticsProxy  = new AnalyticsProxy(request);
                setUserCredentials(GetEmail(), GetPassword());
                DataQuery query = new DataQuery(ConfigurationManager.AppSettings["FeedDataUri"]);
                query.Ids = "ga:" + profile;
                string        dimensions     = details.Dimensions;
                List <string> dimensionsList = new List <string>();
                dimensionsList = getDimensions(dimensions);
                if (dimensions != "")
                {
                    dimensions = "ga:" + dimensionsList.First();
                }
                else
                {
                    dimensions = "";
                }

                for (int i = 1; i < dimensionsList.Count; i++)
                {
                    dimensions += ",ga:" + dimensionsList[i];
                }
                query.Dimensions = dimensions;
                string        metrics    = details.Metrics;
                List <string> metricList = new List <string>();
                metricList = getMetrics(metrics);
                if (metrics != "")
                {
                    metrics = "ga:" + metricList.First();
                }
                else
                {
                    metrics = "";
                }
                metrics = "ga:" + metricList.First();
                for (int i = 1; i < metricList.Count; i++)
                {
                    metrics += ",ga:" + metricList[i];
                }
                query.Metrics     = metrics;
                query.GAStartDate = details.From.ToString("yyyy-MM-dd");
                log.Info("StartDate: " + details.From);
                query.GAEndDate = details.To.ToString("yyyy-MM-dd");
                log.Info("EndDate: " + details.To);
                query.Sort             = details.Sort;
                query.NumberToRetrieve = details.Max;


                this.RetrievedData = Query(query);
                return(RetrievedData);
            }
            catch (GDataRequestException ex)
            {
                throw ex;
            }
        }