This extension enables metrics and A/B testing using the Vanity library (vanity.labnotes.org).
Note that this version is incompatible with the metrics data from the previous version if the bundled Vanity gem was used. Vanity is no longer bundled with the extension and must be installed separately.
Place the files for this extension within vendor/extensions/metrics in your Radiant application, and restart your server.
Via git clone:
git clone git://github.com/jemmyw/radiant-metrics-extension.git vendor/extensions/metrics
Via extension script:
script/extension install metrics
Run ‘rake gems` after installation for required gems.
Now run:
-
rake radiant:extensions:metrics:migrate
-
rake radiant:extensions:metrics:update
The Vanity gem requires Redis (code.google.com/p/redis/) to be running as a datastore. Alternatively a version of Vanity with ActiveRecord support is available at github.com/jemmyw/vanity
Create metrics and A/B tests under the new metrics tab in the Radiant admin.
Now you can do the following on your pages:
<r:track name="Signup" />
This will increment a metric named Signup.
<r:ab:test name="homepage test"> <r:a>Half your users will be shown this text</r:a> <r:b>The other half will be shown this text</r:b> </r:ab:test>
This will run the A/B test named “homepage test”. Under the metrics dashboard tab you will see the results for the test.
Note: using <r:track> or <r:ab:test> will switch off caching for that page.
You can run an A/B test by creating a new page of the type AbTest. This will alternatively display the first two children of the page in it’s place.
You can also track metrics via Javascript. Using the Javascript tracking allows the page to be cached. Include the following in your layout:
<script type="text/javascript" src="/javascripts/metrics-min.js"></script>
Now you can track a metric via AJAX javascript calls:
<a href="http://example.com/signup" onclick="Metrics.track('signup');">Sign up now!</a>