Module: AhoyCaptain

Defined in:
lib/ahoy_captain.rb,
lib/ahoy_captain/goals.rb,
lib/ahoy_captain/engine.rb,
lib/ahoy_captain/funnels.rb,
lib/ahoy_captain/railtie.rb,
lib/ahoy_captain/version.rb,
app/models/ahoy_captain/export.rb,
app/models/ahoy_captain/widget.rb,
lib/ahoy_captain/configuration.rb,
lib/ahoy_captain/predicate_label.rb,
app/models/ahoy_captain/rangeable.rb,
lib/ahoy_captain/period_collection.rb,
app/queries/ahoy_captain/city_query.rb,
lib/ahoy_captain/ahoy/event_methods.rb,
lib/ahoy_captain/ahoy/visit_methods.rb,
app/queries/ahoy_captain/event_query.rb,
app/queries/ahoy_captain/visit_query.rb,
app/models/ahoy_captain/filter_parser.rb,
app/queries/ahoy_captain/device_query.rb,
app/queries/ahoy_captain/region_query.rb,
app/queries/ahoy_captain/source_query.rb,
app/queries/ahoy_captain/country_query.rb,
lib/ahoy_captain/filters_configuration.rb,
app/models/ahoy_captain/comparison_mode.rb,
app/queries/ahoy_captain/campaign_query.rb,
app/queries/ahoy_captain/top_page_query.rb,
app/models/ahoy_captain/range_from_params.rb,
app/queries/ahoy_captain/exit_pages_query.rb,
app/queries/ahoy_captain/stats/base_query.rb,
app/decorators/ahoy_captain/city_decorator.rb,
app/decorators/ahoy_captain/page_decorator.rb,
app/models/concerns/ahoy_captain/limitable.rb,
app/queries/ahoy_captain/application_query.rb,
app/queries/ahoy_captain/entry_pages_query.rb,
app/helpers/ahoy_captain/application_helper.rb,
app/presenters/ahoy_captain/goals_presenter.rb,
app/decorators/ahoy_captain/device_decorator.rb,
app/decorators/ahoy_captain/region_decorator.rb,
app/decorators/ahoy_captain/source_decorator.rb,
app/presenters/ahoy_captain/funnel_presenter.rb,
lib/ahoy_captain/filter_configuration/filter.rb,
app/controllers/ahoy_captain/goals_controller.rb,
app/controllers/ahoy_captain/roots_controller.rb,
app/controllers/ahoy_captain/stats_controller.rb,
app/decorators/ahoy_captain/country_decorator.rb,
app/models/concerns/ahoy_captain/compare_mode.rb,
lib/generators/ahoy_captain/install_generator.rb,
app/components/ahoy_captain/combobox_component.rb,
app/decorators/ahoy_captain/campaign_decorator.rb,
app/decorators/ahoy_captain/top_page_decorator.rb,
app/models/concerns/ahoy_captain/range_options.rb,
app/controllers/ahoy_captain/devices_controller.rb,
app/controllers/ahoy_captain/exports_controller.rb,
app/controllers/ahoy_captain/funnels_controller.rb,
app/controllers/ahoy_captain/sources_controller.rb,
app/decorators/ahoy_captain/exit_page_decorator.rb,
app/presenters/ahoy_captain/dashboard_presenter.rb,
lib/generators/ahoy_captain/migration_generator.rb,
app/components/ahoy_captain/tables/dynamic_table.rb,
app/decorators/ahoy_captain/entry_page_decorator.rb,
app/controllers/ahoy_captain/campaigns_controller.rb,
app/controllers/ahoy_captain/realtimes_controller.rb,
app/controllers/ahoy_captain/top_pages_controller.rb,
app/decorators/ahoy_captain/application_decorator.rb,
app/queries/ahoy_captain/stats/bounce_rates_query.rb,
app/controllers/ahoy_captain/exit_pages_controller.rb,
app/controllers/ahoy_captain/properties_controller.rb,
app/controllers/ahoy_captain/stats/base_controller.rb,
app/queries/concerns/ahoy_captain/comparable_query.rb,
app/components/ahoy_captain/previous_next_component.rb,
app/components/ahoy_captain/tables/header_component.rb,
app/controllers/ahoy_captain/application_controller.rb,
app/controllers/ahoy_captain/entry_pages_controller.rb,
app/queries/ahoy_captain/stats/total_visitors_query.rb,
app/queries/ahoy_captain/stats/visit_duration_query.rb,
app/controllers/ahoy_captain/filters/base_controller.rb,
app/controllers/ahoy_captain/filters/utms_controller.rb,
app/queries/ahoy_captain/stats/total_pageviews_query.rb,
app/queries/ahoy_captain/stats/unique_visitors_query.rb,
app/queries/ahoy_captain/stats/views_per_visit_query.rb,
app/queries/concerns/ahoy_captain/comparable_queries.rb,
app/components/ahoy_captain/stats/container_component.rb,
app/components/ahoy_captain/tables/rows/row_component.rb,
app/controllers/ahoy_captain/filters/goals_controller.rb,
app/controllers/ahoy_captain/locations/maps_controller.rb,
app/controllers/ahoy_captain/filters/screens_controller.rb,
app/controllers/ahoy_captain/filters/sources_controller.rb,
app/queries/concerns/ahoy_captain/lazy_comparable_query.rb,
lib/ahoy_captain/filter_configuration/filter_collection.rb,
app/components/ahoy_captain/tables/goals_table_component.rb,
app/controllers/ahoy_captain/locations/cities_controller.rb,
app/controllers/ahoy_captain/filters/locations_controller.rb,
app/controllers/ahoy_captain/locations/regions_controller.rb,
app/components/ahoy_captain/tables/devices_table_component.rb,
app/components/ahoy_captain/tables/dynamic_table_component.rb,
app/controllers/ahoy_captain/stats/bounce_rates_controller.rb,
app/controllers/ahoy_captain/stats/total_visits_controller.rb,
app/components/ahoy_captain/tables/headers/header_component.rb,
app/controllers/ahoy_captain/locations/countries_controller.rb,
app/queries/ahoy_captain/stats/average_visit_duration_query.rb,
app/queries/ahoy_captain/stats/average_views_per_visit_query.rb,
app/components/ahoy_captain/tables/properties_table_component.rb,
app/controllers/ahoy_captain/filters/pages/actions_controller.rb,
app/controllers/ahoy_captain/stats/total_pageviews_controller.rb,
app/controllers/ahoy_captain/stats/unique_visitors_controller.rb,
app/controllers/ahoy_captain/stats/visit_durations_controller.rb,
app/controllers/ahoy_captain/stats/views_per_visits_controller.rb,
app/components/ahoy_captain/stats/comparable_container_component.rb,
app/controllers/ahoy_captain/filters/pages/exit_pages_controller.rb,
app/controllers/ahoy_captain/filters/properties/names_controller.rb,
app/controllers/ahoy_captain/filters/pages/entry_pages_controller.rb,
app/controllers/ahoy_captain/filters/properties/values_controller.rb,
app/controllers/ahoy_captain/filters/operating_systems/names_controller.rb,
app/controllers/ahoy_captain/filters/operating_systems/versions_controller.rb

Defined Under Namespace

Modules: Ahoy, ApplicationHelper, ComparableQueries, ComparableQuery, CompareMode, Filters, Generators, LazyComparableQuery, Limitable, Locations, RangeOptions, Rangeable, Stats, Tables Classes: ApplicationController, ApplicationDecorator, ApplicationQuery, CampaignDecorator, CampaignQuery, CampaignsController, CityDecorator, CityQuery, ComboboxComponent, ComparisonLinkComponent, ComparisonMode, Configuration, CountryDecorator, CountryQuery, DashboardPresenter, DeviceDecorator, DeviceQuery, DevicesController, DropdownButtonComponent, DropdownLinkComponent, Engine, EntryPageDecorator, EntryPagesController, EntryPagesQuery, EventQuery, ExitPageDecorator, ExitPagesController, ExitPagesQuery, Export, ExportsController, FilterConfiguration, FilterParser, FiltersConfiguration, Funnel, FunnelCollection, FunnelPresenter, FunnelsController, Goal, GoalCollection, GoalsController, GoalsPresenter, PageDecorator, PeriodCollection, PredicateLabel, PreviousNextComponent, PropertiesController, Railtie, RangeFromParams, RealtimesController, RegionDecorator, RegionQuery, RootsController, SourceDecorator, SourceQuery, SourcesController, StatsController, StickyNavComponent, TableComponent, TileComponent, TooltipComponent, TopPageDecorator, TopPageQuery, TopPagesController, VisitQuery, Widget

Constant Summary collapse

VERSION =
"1.1.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationObject

Returns the value of attribute configuration.



15
16
17
# File 'lib/ahoy_captain.rb', line 15

def configuration
  @configuration
end

Class Method Details

.cacheObject



17
18
19
20
21
22
23
# File 'lib/ahoy_captain.rb', line 17

def cache
  @cache ||= if config.cache[:enabled]
               config.cache[:store]
             else
               ActiveSupport::Cache::NullStore.new
             end
end

.configObject



41
42
43
# File 'lib/ahoy_captain.rb', line 41

def config
  self.configuration ||= Configuration.new
end

.configure {|config| ... } ⇒ Object

Yields:



45
46
47
# File 'lib/ahoy_captain.rb', line 45

def configure
  yield config
end

.eventObject



49
50
51
# File 'lib/ahoy_captain.rb', line 49

def event
  @event ||= config.models[:event].constantize
end

.importmapObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/ahoy_captain.rb', line 25

def importmap
  Importmap::Map.new.draw do
    pin "@hotwired/turbo-rails", to: "turbo.min.js", preload: true
    pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true
    pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true
    pin "application", to: "ahoy_captain/application.js", preload: true
    pin "chartkick", to: "chartkick.js"
    pin "Chart.bundle", to: "Chart.bundle.js"
    pin "chartjs-plugin-datalabels", to: "https://cdn.jsdelivr.net/npm/chartjs-plugin-datalabels@2", preload: true
    pin "classnames", to: "https://cdnjs.cloudflare.com/ajax/libs/classnames/2.3.2/index.min.js", preload: true
    pin "chartjs-chart-geo", to: "https://unpkg.com/chartjs-chart-geo@4", preload: true
    pin_all_from AhoyCaptain::Engine.root.join("app/assets/javascript/ahoy_captain/controllers"), under: "controllers", to: "ahoy_captain/controllers"
    pin_all_from AhoyCaptain::Engine.root.join("app/assets/javascript/ahoy_captain/helpers"), under: "helpers", to: "ahoy_captain/helpers"
  end
end

.noneObject



57
58
59
# File 'lib/ahoy_captain.rb', line 57

def none
  @none ||= OpenStruct.new(text: "(none)", value: "!none!")
end

.visitObject



53
54
55
# File 'lib/ahoy_captain.rb', line 53

def visit
  @visit ||= config.models[:visit].constantize
end