简体   繁体   中英

Query a certain page with Google Analytics API C#

I would like to know the page views for a certain page/url only. Is there a way to add the url to the Google query? Baseurl doesn't seem to work.

DataQuery PageViewQuery = new DataQuery(DataFeedUrl)
{
    Ids = ProfileID,
    Dimensions = "ga:date",
    Metrics = "ga:pageviews",
    Sort = "ga:date",
    GAStartDate = (DateTime.Now).AddDays(-7).ToString("yyyy-MM-dd"),
    GAEndDate = (DateTime.Now).ToString("yyyy-MM-dd")
};

You might try ga:pagePath (plus ga:hostname if you need to retrieve a full URL), or if you have unique page titles ga:pageTitle should be a valid workaround.

Full documentation of dimensions and metric is here: https://developers.google.com/analytics/devguides/reporting/core/dimsmets .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM