Method: Vanity::Configuration#use_js=
- Defined in:
- lib/vanity/configuration.rb
#use_js=(value) ⇒ Object (writeonly)
Call to indicate that participants should be added via js. This helps keep robots from participating in the A/B test and skewing results.
If you want to use this:
-
Add <%= vanity_js %> to any page that needs uses an ab_test. vanity_js needs to be included after your call to ab_test so that it knows which version of the experiment the participant is a member of. The helper will render nothing if the there are no ab_tests running on the current page, so adding vanity_js to the bottom of your layouts is a good option. Keep in mind that if you set config.use_js = true and don’t include vanity_js in your view no participants will be recorded.
Note that a custom JS callback path can be set using:
-
Set config.add_participant_route = ‘/path/to/vanity/action’, this should point to the add_participant path that is added with Vanity::Rails::Dashboard, make sure that this action is available to all users.
152 153 154 |
# File 'lib/vanity/configuration.rb', line 152 def use_js=(value) @use_js = value end |