SpreeGoogleAnalyticsExtras

Introduction goes here.

Installation

Add spree_google_analytics_extras to your Gemfile:

gem 'spree_google_analytics_extras'

Bundle your dependencies and run the installation generator:

bundle
bundle exec rails g spree_google_analytics_extras:install

Usage

Out of the box this extension will send information to Google Analytics for the following actions

  • View the details of a product (spree/products#show)
  • Add a product to the cart from the product's details view

If in your store you have the option to add products directly from a list of products or from any other page, the add to cart button must have the following attributes

<button class="add-to-cart-button" data-sku="PRODUCT_SKU" data-name="PRODUCT_NAME" data-price="PRODUCT_PRICE"></button>

It can be a button or an a tag or any element that has the add-to-cart-button css class and responds to the click event.

Testing

First bundle your dependencies, then run rake. rake will default to building the dummy app if it does not exist, then it will run specs. The dummy app can be regenerated by using rake test_app.

bundle
bundle exec rake

When testing your applications integration with this extension you may use it's factories.
Simply add this require statement to your spec_helper:

require 'spree_google_analytics_extras/factories'

Copyright (c) 2015 [name of extension creator], released under the New BSD License

Comments

No comments yet

Please login to add comment.