Class: Slimmer::Processors::GoogleAnalyticsConfigurator
- Inherits:
-
Object
- Object
- Slimmer::Processors::GoogleAnalyticsConfigurator
- Defined in:
- lib/slimmer/processors/google_analytics_configurator.rb
Constant Summary collapse
- PAGE_LEVEL_EVENT =
3
Instance Method Summary collapse
- #filter(src, dest) ⇒ Object
-
#initialize(response, artefact) ⇒ GoogleAnalyticsConfigurator
constructor
A new instance of GoogleAnalyticsConfigurator.
Constructor Details
#initialize(response, artefact) ⇒ GoogleAnalyticsConfigurator
Returns a new instance of GoogleAnalyticsConfigurator.
7 8 9 10 |
# File 'lib/slimmer/processors/google_analytics_configurator.rb', line 7 def initialize(response, artefact) @headers = response.headers @artefact = artefact end |
Instance Method Details
#filter(src, dest) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/slimmer/processors/google_analytics_configurator.rb', line 12 def filter(src, dest) custom_vars = [] if @artefact custom_vars << set_custom_var_downcase(1, "Section", @artefact.primary_root_section["title"]) if @artefact.primary_root_section custom_vars << set_custom_var_downcase(3, "NeedID", @artefact.need_id) custom_vars << set_custom_var_downcase(4, "Proposition", (@artefact.business_proposition ? 'business' : 'citizen')) unless @artefact.business_proposition.nil? end custom_vars << set_custom_var(9, "Organisations", @headers[Slimmer::Headers::ORGANISATIONS_HEADER]) custom_vars << set_custom_var_downcase(2, "Format", @headers[Slimmer::Headers::FORMAT_HEADER]) custom_vars << set_custom_var_downcase(5, "ResultCount", @headers[Slimmer::Headers::RESULT_COUNT_HEADER]) if dest.at_css("#ga-params") dest.at_css("#ga-params").content += custom_vars.compact.join("\n") end end |