Skip to content

Instantly share code, notes, and snippets.

@mskutta
Created May 11, 2015 18:03
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mskutta/0668cfe6f65f4200c817 to your computer and use it in GitHub Desktop.
Social Sort Manager.cs
private DataResource.GaResource.GetRequest GetRequest(AnalyticsService service)
{
// format the profile id
var profileId = _settings.GoogleAnalyticsProfileId;
if (!profileId.Contains("ga:"))
profileId = string.Format("ga:{0}", profileId);
var window = _settings.WindowInDays;
var startDate = DateTime.Now.AddDays(-window);
var endDate = DateTime.Now;
var request = service.Data.Ga.Get(profileId, startDate.ToString("yyyy-MM-dd"), endDate.ToString("yyyy-MM-dd"), "ga:pageviews,ga:socialInteractions");
request.Dimensions = "ga:pageTitle";
return request;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment