Skip to content
This repository was archived by the owner on Nov 2, 2022. It is now read-only.

Configure environments within the database

Gaelan Lloyd edited this page May 6, 2020 · 5 revisions

Step 3.1. Set up the sites table.

  • This table records the sites that you want to track data for.
  • Create one record per site you want to track.
  • (Optional) Since data can be entered into the database manually, you can create records for sites you won't be automatically fetching data for.
Column Description
id The auto-incrementing unique identifier for a row.
name Enter the name you want to display in charts for this site.
alt_name (Optional) Provide an alternate name that you want to use for the site, useful in some instances when customizing the charts is necessary.
showData If 1, show data charts for this site in the reporting front-end.
fetchData If 1, the fetch script will collect new data for this site.
gan_view_id Instructs Laika which view in Google Analytics to fetch data from. To find this number, browse to the data dashboard in Google Analytics you want to use, then click on Admin, then under View click on View settings. The View ID is at the top of the page, this is the number you want to enter.
additional_metrics By default, Laika will fetch data for all items in the metrics table where is_global = 1. Provide a comma-separated list (with no spaces, like: 1,3,10,23) for the other metrics that you'd like to fetch for this site.

Step 3.2. Set up the metrics table.

  • This table stores instructions on how to obtain the individual metrics you wish to track.
  • Create one record per metric you want to track.
  • (Optional) Since data can be entered into the database manually, you can create records for metrics you won't be automatically fetching data for.
Column Description
id The auto-incrementing unique identifier for a row.
name Enter the name you want to display in charts for this metric.
is_global If 1, this metric will be looked up for all sites in the system with showData = 1.
gan_view_id Instructs Laika which view in Google Analytics to fetch data from. To find this number, browse to the data dashboard in Google Analytics you want to use, then click on Admin, then under View click on View settings. The View ID is at the top of the page, this is the number you want to enter.
operation Learn about operations.

Step 3.3. Set up the nav_groups table.

  • This table allows the left-hand navigation menu items defined in nav_items to be presented in groups.
  • Create one record for each navigation group.
  • (Optional) You can create a group-less, first "Overview" item by creating the first group and not supplying a group_name.
  • Group items are sorted in ascending order by id.
Column Description
id The auto-incrementing unique identifier for a row.
group_name The text that displays as the group title. This field is optional but recommended for most groups.

Step 3.4. Set up the nav_items table.

  • This table stores the individual left-hand navigation menu items.
  • Create one record for each navigation item.
Column Description
id The auto-incrementing unique identifier for a row.
group_id The number of the menu group this menu item should be listed under.
menu_item_title The text that displays for this menu item.
report_layout Learn about report layouts.
report_header (Optional) The H1 that will appear at the top of every automatically-generated, simple report page. Enter this as direct text with no HTML tags around it (because it will be surrounded by H1 tags when it is written to the screen).
report_description (Optional) Enter freeform HTML here that describes the report. This will show up under the report_header and can be paragraphs, list items, or any combination of HTML that makes sense to help describe the report. This field will not be displayed if the report_header is not defined.

Step 3.5. (Optional) Set up the goals table.

Due to the way that Google Analytics stores goals data, this fetching operation is more complex than other operations. Laika has built-in support for fetching goals data, which is explained in detail on the operations page.

Column Description
id The auto-incrementing unique identifier for a row.
report_item The metrics table id that this goal will store data in.
site The site that this data is storing data for.
gan_profile The Google Analytics profile that contains the goal to fetch data from.
goal_id The specific Goal ID within the Google Analytics profile to fetch data from.

Clone this wiki locally