####  Analytics

* The architecture of analytics supports a protected default provider named internal, and an external provider.
* Both of them, internal and external can run in paralel.
* Internal provider is google analytics, and it will always be turned on.
* External provider is google analytics, and by default is turned off.
* Google analytics script is injected in index.ejs file.

#### Above is the structure of external analytics json file

* In the elements section are all the keys which are supported (these can be extended).
* Default key can be removed.

{
  "bbAnalytics": {
    "placeholder": {
      "enable": {
        "default": false,
        "values": [
          true,
          false
        ]
      }
    },
    "provider": {
      "placeholder": {
        "default": {
          "type": "googleAnalytics",
          "id": "UA-52001975-1"
        }
      },
      "values": "*bbc"
    },
    "elements": {
      "errors": {
        "default": {
          "alert": {
            "category": "Errors and alerts",
            "action": "Alert thrown",
            "label": "Alert message"
          },
          "fieldInvalid": {
            "trigger": "show",
            "category": "Errors and alerts",
            "action": "Alert thrown",
            "label": "Alert message"
          }
        },
        "values": "*bbc"
      },
      "pagination": {
        "default": {
          "pageChanged": {
            "category": "Pagination",
            "action": "Page changed",
            "label": "Page"
          }
        },
        "values": "*bbc"
      },
      "routes": {
        "default": {
          "pageRouting": {
            "category": "Routing",
            "action": "Page changed",
            "label": "Page name"
          },
          "widgetInitialised": {
            "category": "Routing",
            "action": "Widget initialised",
            "label": "Details"
          },
          "nextButton": {
            "category": "Navigation",
            "action": "Click next button",
            "label": "from page"
          },
          "backButton": {
            "category": "Navigation",
            "action": "Click back button",
            "label": "from page"
          }
        },
        "values": "*bbc"
      },
      "mapPage": {
        "default": {
          "geolocateButton": {
            "category": "User interactions",
            "action": "Click",
            "label": "Get Current location"
          },
          "searchLocationButton": {
            "category": "User interactions",
            "action": "Click",
            "label": "Search location"
          },
          "openingHours": {
            "category": "User interactions",
            "action": "Click",
            "label": "Opening hours"
          },
          "accordionItem": {
            "category": "User interactions",
            "action": "Click",
            "label": "Accordion item"
          },
          "selectCompanyButton": {
            "category": "User interactions",
            "action": "Click",
            "label": "Select company"
          },
          "selectMapPin": {
            "category": "User interactions",
            "action": "Click",
            "label": "Map pin"
          }
        },
        "values": "*bbc"
      },
      "servicesPage": {
        "default": {
          "showMoreButton": {
            "category": "User Interactions",
            "action": "Click",
            "label": "Show longer description"
          },
          "selectButton": {
            "category": "User Interactions",
            "action": "Click",
            "label": "Selected service"
          },
          "categorySelectButton": {
            "category": "User Interactions",
            "action": "Click",
            "label": "Select category"
          }
        },
        "values": "*bbc"
      },
      "eventsPage": {
        "default": {
          "filterEvent": {
            "category": "User Interactions",
            "action": "Filter events",
            "label": "Filter value"
          },
          "resetFilters": {
            "category": "User Interactions",
            "action": "Click",
            "label": "Reset event filters"
          },
          "hideFullyBookedEventsButton": {
            "category": "User Interactions",
            "action": "Click",
            "label": "Hide fully booked events"
          },
          "showFullyBookedEventsButton": {
            "category": "User Interactions",
            "action": "Click",
            "label": "Show fully booked events"
          },
          "moreInfoButton": {
            "category": "User Interactions",
            "action": "Click",
            "label": "Show more info about event"
          },
          "selectEventButton": {
            "category": "User Interactions",
            "action": "Click",
            "label": "Select event"
          },
          "backFromMoreInfoButton": {
            "category": "User Interactions",
            "action": "Click",
            "label": "Back from more info about event"
          },
          "eventBackButton": {
            "category": "User Interactions",
            "action": "Click",
            "label": "Event back button"
          },
          "reserveTicket": {
            "category": "User Interactions",
            "action": "Click",
            "label": "Reserve ticket"
          },
          "selectTicketsQuantity": {
            "category": "User Interactions",
            "action": "Click",
            "label": "Select tickets quantity"
          },
          "pageChanged": {
            "category": "Pagination",
            "action": "Page changed",
            "label": "Event list"
          }
        },
        "values": "*bbc"
      },
      "calendarPage": {
        "default": {
          "selectedTime": {
            "category": "Selection",
            "action": "Selected - time",
            "label": "time"
          },
          "selectedDay": {
            "category": "Selection",
            "action": "Selected - day",
            "label": "day"
          },
          "selectedDate": {
            "category": "Selection",
            "action": "Selected - date",
            "label": "date"
          },
          "timezone": {
            "category": "Calendar interactions",
            "action": "Select timezone",
            "label": "Timezone"
          },
          "staffFilter": {
            "category": "Calendar interactions",
            "action": "Select staff",
            "label": "Staff"
          },
          "resourceFilter": {
            "category": "Calendar interactions",
            "action": "Select resource",
            "label": "Resource"
          },
          "selectSlot": {
            "category": "Calendar interactions",
            "action": "Select slot",
            "label": "Date and Time"
          },
          "nextWeek": {
            "category": "Calendar interactions",
            "action": "Click",
            "label": "Next week"
          },
          "previousWeek": {
            "category": "Calendar interactions",
            "action": "Click",
            "label": "Previous week"
          },
          "nextMonth": {
            "category": "Calendar interactions",
            "action": "Click",
            "label": "Next month"
          },
          "previousMonth": {
            "category": "Calendar interactions",
            "action": "Click",
            "label": "Previous month"
          }
        },
        "values": "*bbc"
      },
      "confirmationPage": {
        "default": {
          "printButton": {
            "category": "User interactions",
            "action": "Click",
            "label": "Print button"
          },
          "redirectionButton": {
            "category": "User interactions",
            "action": "Click",
            "label": "Redirection button"
          },
          "exportBookingButton": {
            "category": "User interactions",
            "action": "Click",
            "label": "Export booking button"
          },
          "exportBookingOutlookButton": {
            "category": "User interactions",
            "action": "Click",
            "label": "Export booking outlook button"
          },
          "exportBookingGoogleButton": {
            "category": "User interactions",
            "action": "Click",
            "label": "Export booking google button"
          },
          "exportBookingIcalButton": {
            "category": "User interactions",
            "action": "Click",
            "label": "Export booking iCal button"
          }
        },
        "values": "*bbc"
      },
      "basketSummaryPage": {
        "default": {
          "confirmButton": {
            "category": "User Interactions",
            "action": "Click",
            "label": "Confirm basket summary"
          }
        },
        "values": "*bbc"
      },
      "checkItemsPage": {
        "default": {
          "addAttendeeButton": {
            "category": "User Interactions",
            "action": "Click",
            "label": "Add attendee clicked"
          }
        },
        "values": "*bbc"
      },
      "viewBookingPage": {
        "default": {
          "cancelButton": {
            "category": "User Interactions",
            "action": "Click",
            "label": "Cancel purchase clicked"
          },
          "dismissCancelPurchaseModalButton": {
            "category": "User Interactions",
            "action": "Click",
            "label": "Cancel purchase modal was dismissed"
          },
          "proceedCancelPurchaseModalButton": {
            "category": "User Interactions",
            "action": "Click",
            "label": "Cancel purchase confirmation button clicked"
          },
          "rescheduleButton": {
            "category": "User Interactions",
            "action": "Click",
            "label": "Reschedule booking button clicked"
          },
          "removeTicketsButton": {
            "category": "User Interactions",
            "action": "Click",
            "label": "Remove tickets button clicked"
          },
          "dismissRemoveTicketsModalButton": {
            "category": "User Interactions",
            "action": "Click",
            "label": "Remove tickets modal dismissed"
          },
          "proceedRemoveTicketsModalButton": {
            "category": "User Interactions",
            "action": "Click",
            "label": "Remove tickets confirmation button clicked"
          },
          "closeModalRemoveTicketsFromIcon": {
            "category": "User Interactions",
            "action": "Click",
            "label": "Remove tickets modal - close icon"
          },
          "purchaseCancelled": {
            "category": "Conversion",
            "action": "Action",
            "label": "Purchase was cancelled"
          },
          "ticketsRemoved": {
            "category": "Conversion",
            "action": "Action",
            "label": "One or more tickets were removed"
          }
        },
        "values": "*bbc"
      }
    }
  }
}
