Skip to content

Commit

Permalink
support for clicktale 'param' + readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Mazyar committed Jun 3, 2009
1 parent c61f234 commit c15b40d
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 16 deletions.
37 changes: 23 additions & 14 deletions README.rdoc
Expand Up @@ -11,30 +11,39 @@ Clicktale records user sessions, clicks, form input etc and plays them back late

> ./script/plugin install git://github.com/astrails/clicktale.git

OR
* head to http://clicktale.net and signup for a free account. Or not free. Your choice.

> gem install astrails-clicktale --source http://gems.github.com/
and then
> clicktailize YOUR_RAILS_DIR
* get a tracking code from clicktale. It should look something like this:

* edit the autogenerated config/clicktale.yml and replace CLICKTALE_PROJECT_ID with your clicktale project id
<!-- ClickTale Bottom part -->
<div id="ClickTaleDiv" style="display: none;"></div>
<script src="http://s.clicktale.net/WRb.js" type="text/javascript"></script>
<script type="text/javascript">
if(typeof ClickTale=='function') ClickTale(<project_id>,<ratio>,<param>);
</script>
<!-- ClickTale end of Bottom part -->

* replace <project_id>, <ratio> and <param> in the autogenerated config/clicktale.yml with values from
clicktale tracking code.

* add partials into layout inside the 'body' tag

<body>
<%= clicktale_top %>
...
<%= yield %>
...
<%= clicktale_bottom %>
</body>
<body>
<%= clicktale_top %>
...
<%= yield %>
...
<%= clicktale_bottom %>
</body>

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:
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

Another Note: As of this writing, clicktale service ignores existance of Safari browser. I hope it will someday.

== Copyright

Copyright (c) 2009 Michael Mazyar. See LICENSE for details.
6 changes: 5 additions & 1 deletion app/views/clicktale/_bottom.html.erb
@@ -1,6 +1,6 @@
<div id="ClickTaleDiv" style="display: none;" />

<%= javascript_include_tag "WRb.js" %>
<script src="<%= request.protocol %>s.clicktale.net/WRb.js" type="text/javascript"></script>
<script type="text/javascript">
if(typeof ClickTale == 'function') {
<%- if request.ssl? -%>
Expand All @@ -10,6 +10,10 @@
ClickTaleTag('<%= tag %>');
<%- end -%>
var ClickTaleFetchFrom = '<%= path %>';
<%- if param -%>
ClickTale(<%= project_id %>, <%= ratio %>, "<%= param %>");
<%- else -%>
ClickTale(<%= project_id %>, <%= ratio %>);
<% end -%>
}
</script>
1 change: 1 addition & 0 deletions config/clicktale.yml
@@ -1,6 +1,7 @@
default: &default
project_id: CLICKTALE_PROJECT_ID
ratio: 1
param: CLICKTALE_PARAM

production:
<<: *default
Expand Down
3 changes: 2 additions & 1 deletion lib/astrails/clicktale/helper.rb
Expand Up @@ -13,7 +13,8 @@ def clicktale_bottom
:project_id => clicktale_config[:project_id],
:path => clicktale_url,
:ratio => clicktale_config[:ratio] || 1,
:tag => clicktale_config[:tag]
:tag => clicktale_config[:tag],
:param => clicktale_config[:param]
}
end
end
Expand Down

0 comments on commit c15b40d

Please sign in to comment.