Hi all, code at bottom.
I am trying to return data with pageTitle as the primary dimension. Not sure if that actually makes since or not...
Long story short, posts on my website may have multiple URLs. But each post has the same title. So I want to use pageTitle as a unique id to query on that may return multiple pagePaths. By doing this I hope to add pageviews on multiple pagePaths to one total pageview count by pageTitle.
This theory works if I query *only* the pageTitle. But if I query both the pageTitle and pagePath (no matter the order) it returns pageviews based on pagePath.
Short of making two queries and merging data, is there any way to query based on pageTitle and also get the pagePath? Is there a work around to return the absolute page URL as as to avoid pagePath altogether?
Thanks, Rob
def get_results(service):
return service.data().ga().get(
ids=get_secret("tableID"),
start_date=yesterday,
end_date=yesterday,
metrics='ga:pageviews',
dimensions='ga:pageTitle,ga:pagePath',
sort='-ga:pageviews',
max_results='5' ).execute()