var dataChart = new gapi.analytics.googleCharts.DataChart({ query: { metrics: 'ga:pageviews', dimensions: 'ga:pageTitle', filters: 'ga:pageTitle =~ %5ELecture\s.*', 'start-date': '30daysAgo', 'end-date': 'yesterday' }, chart: { container: 'chart-container', type: 'COLUMN', options: { width: '100%' } } });
Above is the code that google embed api gave me for a quick dashboard as shown in the "embed code api tutorial" on google's analytics website. This simple dashboard is enough for what I desire to be shown on my website, however, after fetching the data I have to filter some of it... Specifically, the "dimension". According to the following link, https://developers.google.com/analytics/devguides/reporting/core/v2/gdataReferenceDataFeed, the syntax for filtering a metric or dimension is shown. However, this isn't not returning any chart onto my website, and so I believe the syntax to be wrong. When I remove the line of code beginning with "filters:", a chart is displayed according to the prescribed metrics and dimensions simply without any filter...
Where am I going wrong with the syntax for the filter?
I have tried many different possibilities, including URL encoded characters as opposed to ga's syntax... Any help is appreciated, thank you!