Socket
Book a DemoInstallSign in
Socket

bacchanalytics

Package Overview
Dependencies
Maintainers
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bacchanalytics

0.1.9
bundlerRubygems
Version published
Maintainers
4
Created
Source

Bacchanalytics

Bacchanalytics is a rack middleware that inserts the Asynchronous Google Analytics Tracking Code in your application.

Installation

gem install bacchanalytics

Continuous Integration

Build Status

Usage in a Rails Application

Add the following line in your config/environment.rb:

  config.middleware.use "Bacchanalytics::Analytics", :web_property_id => "UA-XXXXX-X"

You have to replace "UA-XXXXX-X" with the Google Analytics property ID of your site. You can find more information on the Google Analytics property ID in http://code.google.com/apis/analytics/docs/concepts/gaConceptsAccounts.html#accountID

You are able to set the domain name of your site.

  config.middleware.use "Bacchanalytics::Analytics", :web_property_id => "UA-XXXXX-X"
                                                     :domain_name => ".facturagem.com"

You can also use "ignored organic" features in your pages with:

config.middleware.use "Bacchanalytics::Analytics", :web_property_id => "UA-XXXXXXX-X",
                                                   :ignored_organic => ["yoursite",
                                                                        "yoursite.com",
                                                                        "www.yoursite.com",
                                                                        "http://www.yoursite.com",
                                                                        "http://yoursite.com"]

Google Website Optimizer

In order to use A/B tests, just add the following lines to your config/environment.rb:

config.middleware.use "Bacchanalytics::WebsiteOptimizer", :account_id => 'UA-XXXXXXXX-X',
                                                          :ab => { 'NNNNNNNNNN' => {:a => ["/", "/public/index"],
                                                                                    :b => "/home2",
                                                                                    :goal => "/public/signup"}
                                                          }

where 'UA-XXXXXXXX-X' is the ID of the Website Optimizer account and 'NNNNNNNNNN' is the track page id, a key provided in the Website Optimizer javascript. The 'ab' hash contains the A (origin) pages, the B (variations) pages and the goal pages.

The embeded javascript looks like:

      <!-- Google Website Optimizer Tracking Script -->
      <script type="text/javascript">
        var _gaq = _gaq || [];
        _gaq.push(['gwo._setAccount', 'UA-XXXXXXXX-X']);
        _gaq.push(['gwo._trackPageview', '/3203696384/test']);
        (function() {
          var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
          ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
          var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
        })();
      </script>
      <!-- End of Google Website Optimizer Tracking Script -->

As you can see, the 'NNNNNNNNNN' is the '3203696384' track page ID.

Google Adwords Conversions

config.middleware.use "Bacchanalytics::AdwordsConversion", [
                                                            {:id => 'NNNNNNNNNN',
                                                             :label => 'oIiDCJe__QEQqcrF-gM',
                                                             :language => 'es',
                                                             :format => 3,
                                                             :value => 3.5,
                                                             :description => '',
                                                             :pages=>[ "/welcome", "/en/welcome", "/es/welcome", "/ca/welcome", "/eu/welcome"]
                                                            }
                                                           ]

Copyright (c) 2011 ASPgems, released under the MIT license

FAQs

Package last updated on 02 Nov 2011

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.