## Configuration
Each widget has it's won small configuration block in the extensions configuration yaml inside the **widgets** array.

### Common configuration values

 * **widget** The class name of the widget's php class without namespace. ex: ContentListWidget
 * **title** Display title of the widget inside it's header
 * **text** Short text content above the widget's data
 * **icon** Fontawesome icon name of the icon show on the left of the widget
 * **location** One of the location constants of Bolt's widget system (Note that only backend locations are supported for most of these widgets)
 * **class** An optionl additional class of this widgets html snippet
 
```
widgets:
    - widget: ContentListWidget
      title: Some very cool widget
      text: This is the intro text of a very cool widget.
      icon: fa-bullhorn
      location: dashboard_below_header
      class: panel-primary
``` 
 
### ContentListWidget configuration
Additional configuration values for this widget

 * **select** A array of parameters as supported by the **selectContent** function of the **cnd/library** extension
 
```
      ...
      select:
           contenttypes: [article,showcase]
           order: {datechanged: false}
           limit: 5
           filter: {ownerid: %CURRENTUSERID%, status: draft}
``` 

### SocialStatsWidget configuration
Additional configuration values for this widget

 * **services** An array of services to show. Can be any combination of: **facebook**, **linkedin**, **pinterest**

### Google Analytics Widget configuration
All google analytics widgets have the same configuration.
**Note** Some variants have limitations on the kind of report that makes sense or can be displayed for it. For example,
you can specify more than one dimension, but a table can not display more than one.

 * **api/key-file** The path to the key file to use for the google analytics api. This can be obtained in google's api administration website
 * **report/cache** Number of seconds this report can be cached
 * **report/view** The id of the report view to use. Can be obtained in google's analytics administration website
 * **report/metrics** One or more metric to request in this report. They need a key and a label. keys can be found in the google analytics report explorer
 * **report/dimensions** One or more dimensions to request in this report. They need a key and a label. keys can be found in the google analytics report explorer
 * **report/filters** A list of string to filter the report by.
 * **report/daterange** the timeframe to generate the report over. Needs a **from** and a **to** key 
 
There are several placeholder you can use in this configuration:
 
 * **PAGEPATH** relative url to currently opened page
 * **CURRENTUSERID** user id of currently authenticated user
 * **CURRENTUSERNAME** username of currently authenticated user
 * **CURRENTUSERDISPLAYNAME** display name of currently authenticated user

```
      api:
           key-file: app/config/extensions/google-api-credentials.json
      report:
           cache: 3600
           view: "ga:111634650"
           metrics: # The Y-Axis (the chart can only display two axis, more than that will overlap on the right)
               - key: "ga:uniquePageviews"
                 label: Unique Pageviews
               - key: "ga:exitRate"
                 label: Exit Rate
           dimensions: # The X-Axis (Only one X-Axis is supported at this moment
               - key: "ga:nthDay"
                 label: Tage
           filters:
                - "ga:pagepath==%PAGEPATH%"
           daterange:
               from: 30daysAgo
               to: today
```               

## Google Analytics - Sample Reports

### Page Performance Graph
Displays two metrics, **Unique Pageviews** and **Exit Rate** for the current page over the last 30 days as a small 
widget on the right of an edited page.
**Note**: If you configure more than two metics, the y-axis labels will no longer be readyble

```
    - widget: GAGraphWidget
      title: Page Performance
      text: Performance of this page over the last 30 days
      icon: fa-area-chart
      location: editcontent_aside_top
      class: panel-info
      api:
           key-file: app/config/extensions/google-api-credentials.json
      report:
           cache: 3600
           view: "ga:12345678"
           metrics:
               - key: "ga:uniquePageviews"
                 label: Unique Pageviews
               - key: "ga:exitRate"
                 label: Exit Rate
           dimensions: # The X-Axis (Only one X-Axis is supported at this moment
               - key: "ga:nthDay"
                 label: Day
           filters:
                - "ga:pagepath==%PAGEPATH%"
           daterange:
               from: 30daysAgo
               to: today
```

### Page Trends
Displays several values and their trend in percentage.
**Note**: Allways use yesterday instead of today as target date. Today is not a full day yet and may be lower than expected.

```
    - widget: GATrendsWidget
      title: Trends of this page
      text: Trends of this page over the last 7 days
      icon: fa-retweet
      location: editcontent_aside_top
      class: panel-info
      api:
           key-file: app/config/extensions/google-api-credentials.json
      report:
           cache: 3600
           view: "ga:123456789"
           metrics:
               - key: "ga:sessions"
                 label: Sessions
               - key: "ga:avgSessionDuration"
                 label: Session Dauer
               - key: "ga:pageviews"
                 label: Page Views
               - key: "ga:exitRate"
                 label: Absprung
               - key: "ga:uniquePageviews"
                 label: Unique Views
           filters:
              - "ga:pagepath==%PAGEPATH%"
           dimensions:
               - key: "ga:nthDay"
                 label: Tage
           daterange:
               from: 7daysAgo
               to: yesterday
```

### Top Pages Table
Display a table of the top 10 pages of the last 30 days according to **Unique Pageviews** and **Exit Rate**.
```
    - widget: GAReportWidget
      title: GA Report
      text: Performance der letzten 30 Tage
      icon: fa-area-chart
      location: editcontent_aside_top
      class: panel-info
      api:
           key-file: app/config/extensions/google-api-credentials.json
      report:
           cache: 3600
           view: "ga:1234567890"
           metrics:
               - key: "ga:uniquePageviews"
                 label: Unique Pageviews
               - key: "ga:exitRate"
                 label: Exit Rate
           dimensions:
               - key: "ga:pageTitle"
                 label: Page Title
           daterange:
               from: 30daysAgo
               to: yesterday
           order:
               - key: "ga:uniquePageviews"
                 direction: false
           page-size: 10
```           

### Google trending keywords
Display the list of trending stories. This widget uses an unofficial api and may stop working if google changes it.

 * **defaults/category** The default selected category
 * **defaults/region** The default selected region


```
    - widget: GATrendingKeywordsWidget
      title: GA Trending keywords
      icon: fa-search
      location: dashboard_below_header
      class: panel-info
      defaults:
           category: t
           region: DE
```           

### Google Taxonomies
Displays a list of the top performing taxonomies in comparison across two date ranges.
The report config differs a bit from the other normale GA reports. Dimensions and order are provided automatically
and only one metric can be specified.

You need to find the custom dimension used for tags from the GA query explorer. In this example, it 
is "ga:dimension20" and contains a comma seperated list of strings.

```
    - widget: GATaxonomyWidget
      title: GA Trending Tags
      text: Tags and their usage across two date ranges
      icon: fa-tags
      location: dashboard_bottom
      class: panel-info
      api:
           key-file: app/config/extensions/google-api-credentials.json
      report:
           cache: 3600
           view: "ga:12345678"
           metric:
               key: "ga:uniquePageviews"
               label: Unique Pageviews
           daterange:
               - from: 30daysAgo
                 to: yesterday
                 label: current 30 days
               - from: 60daysAgo
                 to: 30daysAgo
                 label: last 30 days
           page-size: 10
           taxonomy:
               key: "ga:dimension20"
               label: "Tags"
```