Ruby on Rails integration module

From ClickTale Wiki
(Redirected from Ruby on Rails)
Jump to: navigation, search
ClickTale Wiki
The instructions on this page are intended for self service and online accounts.
Enterprise customers should contact their account managers for integration support.

Michael Mazyar from Astrails, an Israeli web consultancy that specializes in Rails web development, released this implementation of an integration module between ClickTale and Rails.

The implementation allows complex pages of a Rails website to be recorded and cached correctly by the ClickTale service. Complex pages are ones that are dependant on session state or which process POST requests. Those methods often affect pages behind a login, shopping carts and checkout pages. Please note that currently only version 2.X is supported by this module. It is ClickTale's intention to support more advanced versions of RoR in the future.

Contents

Installation

  1. Download the plugin from github.
  2. Install the plugin:
  3. ./script/plugin install git://github.com/astrails/clicktale.git
  4. Replace project_id, ratio and param in the autogenerated config/clicktale.yml with values from your ClickTale tracking code.
  5. Add ClickTale partials into layout inside the ‘body’ tag:
  6.       <body>
            <%= clicktale_top %>
            ...
            <%= yield %>
            ...
            <%= clicktale_bottom %>
          </body>
    
  7. Add a cron job (crontab -e) that will take care of the old cached files
  8. */30 * * * * find /path/to/your/application/public/clicktale/ -type f -mmin +30 -exec rm {} \;

Note: The plugin works by leveraging rails caching mechanism, which is by default only enabled in production environment. To enable the plugin in the development environment do the following:

  • set enabled=true in config/clicktale.yml (development section)
  • set config.action_controller.perform_caching=true in config/environments/development.rb

Options

  • Add ClickTale method on class level in your controller to change the ClickTale project for specific controller
      class UsersController < ApplicationController
        clicktale :project_id => ANOTHER_PROJECT_ID
        ...
      end
  • Call the same method to tag this controller’s actions in clicktale records
      class UsersController < ApplicationController
        clicktale :project_id => ANOTHER_PROJECT_ID, :tag => :specific_tag
        ...
      end
  • You can call the same method with same parameters on the action level to control project id and tag for this specific action

Feedback

Please submit issues to github.

Personal tools