Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle analytics Core reporting v 3 - how to get the base url
    primarykey
    data
    text
    <p>I'm trying to get the base url for Google analytics and for some reason i can't get it to work - I have tried the following:</p> <pre><code> //this is the old url and did use to work ( see `//https://developers.google.com/analytics/devguides/reporting/core/v2/ )` //const string baseUrl = "https://www.google.com/analytics/feeds/data"; // this is also outdated //const string baseUrl = "https://www.googleapis.com/analytics/v2.4/data"; // this doesnt seem to work!!! const string baseUrl = "https://www.googleapis.com/analytics/v3/data"; </code></pre> <p>here is a bit of the code i have written which should build the url</p> <pre><code> const string baseUrl = "https://www.googleapis.com/analytics/v3/data/"; var retailers = affiliateRetailerRepository.GetAffiliateRetailerByScheme(affiliateScheme.Id); foreach (var affiliateRetailer in retailers) { var query = new DataQuery(baseUrl) { Ids = affiliateRetailer.Code, //todo - custom var may neeed to be put back Dimensions = "ga:customVarName(n),transactionId,ga:productName,ga:productSku,ga:date,ga:hour", Dimensions = "transactionId,ga:productName,ga:productSku,ga:date,ga:hour", //Metrics = "ga:itemRevenue,ga:revenuePerItem,ga:itemQuantity", Metrics = "ga:itemRevenue,ga:itemQuantity", Segment = "gaid::-8", Filters = filters, GAStartDate = startDate.ToString("yyyy-MM-dd"), GAEndDate = endDate.ToString("yyyy-MM-dd"), NumberToRetrieve = 10000 }; Uri url = query.Uri; </code></pre> <p>Using the above i get the following http:</p> <p>{https://www.googleapis.com/analytics/v3/data/?max-results=10000&amp;dimensions=transactionId,ga:productName,ga:productSku,ga:date,ga:hour&amp;end-date=2012-08-28&amp;filters=ga:source=@where-to-buy.co,ga:source=@where-to-purchase.us,ga:source=@where-to-buy.fr,ga:source=@wheretopurchase.de,ga:source=@where-to-buy.es,ga:source=@wheretopurchase.it,ga:source=@where-to-purchase.ru,ga:source=@where-to-buy.pl,ga:source=@where-to-buy.se,ga:source=@where-to-buy.nl,ga:source=@where-to-purchase.us,ga:source=@wheretopurchase.ca&amp;ids=ga:57437629&amp;metrics=ga:itemRevenue,ga:itemQuantity&amp;start-date=2012-03-13&amp;segment=gaid::-8} </p> <p>I know that i have code rot as i haven't looked at this piece of code for quite a while but if anyone has any suggestions - i thought it would be simply changing the base url to the most up to date one but that does not seem to work.</p> <p>Any help appreciated. </p> <p>EDIT: Or just if someone has a working url which i could use to build mine that would also be useful as i mentioned this was put together a while ago so it might mean i need to reformat the whole code in line with the new API format so seeing one which works would be useful then i can tailor it to my needs. Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload