Feature: Google Analytics tag helper
Scenario: Basic tracking code
Given a fixture app "test-app"
And a file named "config.rb" with:
"""
activate :google_analytics do |ga|
ga.tracking_id = 'UA-123456-78'
end
"""
Given the Server is running at "test-app"
When I go to "/"
Then I should see:
"""
"""
Scenario: On debug mode
Given a fixture app "test-app"
And a file named "config.rb" with:
"""
activate :google_analytics do |ga|
ga.tracking_id = 'UA-123456-78'
ga.debug = true
end
"""
Given the Server is running at "test-app"
When I go to "/"
Then I should see:
"""
"""
Scenario: Tracking across a domain and its subdomains
Given a fixture app "test-app"
And a file named "config.rb" with:
"""
activate :google_analytics do |ga|
ga.tracking_id = 'UA-123456-78'
ga.domain_name = 'example.com'
end
"""
Given the Server is running at "test-app"
When I go to "/"
Then I should see:
"""
"""
Scenario: Tracking across multiple domains and subdomains
Given a fixture app "test-app"
And a file named "config.rb" with:
"""
activate :google_analytics do |ga|
ga.tracking_id = 'UA-123456-78'
ga.domain_name = 'example.com'
ga.allow_linker = true
end
"""
Given the Server is running at "test-app"
When I go to "/"
Then I should see:
"""
"""
Scenario: Removing the last octet of the IP address
Given a fixture app "test-app"
And a file named "config.rb" with:
"""
activate :google_analytics do |ga|
ga.tracking_id = 'UA-123456-78'
ga.anonymize_ip = true
end
"""
Given the Server is running at "test-app"
When I go to "/"
Then I should see:
"""
"""
Scenario: Disable tracking in development environment
Given a fixture app "test-app"
And a file named "config.rb" with:
"""
activate :google_analytics do |ga|
ga.tracking_id = 'UA-123456-78'
ga.development = false
end
"""
Given the Server is running at "test-app"
When I go to "/"
Then I should see:
"""
"""
Scenario: Compress the JavaScript code
Given a fixture app "test-app"
And a file named "config.rb" with:
"""
activate :google_analytics do |ga|
ga.tracking_id = 'UA-123456-78'
ga.minify = true
end
"""
Given the Server is running at "test-app"
When I go to "/"
Then I should see:
"""
"""
Scenario: Full options
Given a fixture app "test-app"
And a file named "config.rb" with:
"""
activate :google_analytics do |ga|
ga.tracking_id = 'UA-123456-78'
ga.domain_name = 'example.com'
ga.debug = true
ga.allow_linker = true
ga.anonymize_ip = true
ga.development = true
ga.minify = true
end
"""
Given the Server is running at "test-app"
When I go to "/"
Then I should see:
"""
"""