class Itly::Plugin
Parent class for all plugins
When creating a custom plugin, you need to create a child class of Itly::Plugin
Public Instance Methods
Associate one user ID with another (typically a known user ID with an anonymous one).
@param [String] user_id: The ID that the user will be identified by going forward. @param [String] previous_id: The ID the user has been identified by so far. @param [Itly::PluginCallOptions] options: plugin specific option.
# File lib/itly/plugin.rb, line 76 def alias(user_id:, previous_id:, options: nil); end
Flush data
# File lib/itly/plugin.rb, line 83 def flush; end
Associate a user with their group (for example, their department or company), or to set the group's traits.
@param [String] user_id: the id of the user in your application @param [String] group_id: the id of the group in your application @param [Hash] properties: the properties to pass to your application @param [Itly::PluginCallOptions] options: plugin specific option.
# File lib/itly/plugin.rb, line 39 def group(user_id:, group_id:, properties: nil, options: nil); end
Get the plugin ID, which is the underscored class name. Use only the child class in case of nested classes
@return [String] plugin id
# File lib/itly/plugin.rb, line 110 def id name = (self.class.name || 'UnknownPluginClass').gsub('::', '-') name = (name || 'UnknownPluginClass').gsub(/([A-Z]+)/, '_\1').gsub(/-_/, '-').sub(/^_/, '').sub(/^itly-/i, '') name.downcase end
Identify a user in your application and associate all future events with their identity, or to set their traits.
@param [String] user_id: the id of the user in your application @param [Hash] properties: the properties containing user's traits to pass to your application @param [Itly::PluginCallOptions] options: plugin specific options.
# File lib/itly/plugin.rb, line 26 def identify(user_id:, properties: nil, options: nil); end
Called when the Itly
SDK is being loaded and is ready to load your plugin.
@param [Itly::PluginOptions] options: The option for the plugin
# File lib/itly/plugin.rb, line 16 def load(options:); end
Let record page views, along with optional extra information about the page viewed by the user.
@param [String] user_id: the id of the user in your application @param [String] category: the category of the page @param [String] name: the name of the page. @param [Hash] properties: the properties to pass to your application @param [Itly::PluginCallOptions] options: plugin specific option.
# File lib/itly/plugin.rb, line 52 def page(user_id:, category: nil, name: nil, properties: nil, options: nil); end
# File lib/itly/plugin.rb, line 78 def post_alias(user_id:, previous_id:); end
# File lib/itly/plugin.rb, line 41 def post_group(user_id:, group_id:, properties:, validation_results:); end
# File lib/itly/plugin.rb, line 28 def post_identify(user_id:, properties:, validation_results:); end
# File lib/itly/plugin.rb, line 54 def post_page(user_id:, category:, name:, properties:, validation_results:); end
# File lib/itly/plugin.rb, line 67 def post_track(user_id:, event:, validation_results:); end
Reset the SDK's (and all plugins') state. This method is usually called when a user logs out.
# File lib/itly/plugin.rb, line 93 def reset; end
Stop all processes and free resources.
# File lib/itly/plugin.rb, line 88 def shutdown; end
Track an event, call the event's corresponding function.
See +Itly#track+ for more information
@param [String] user_id: the id of the user in your application @param [Event] event: the events to track @param [Itly::PluginCallOptions] options: plugin specific option.
# File lib/itly/plugin.rb, line 65 def track(user_id:, event:, options: nil); end
Validate an Event
See +Itly#validate+ for more information
Your plugin can return a Itly::ValidationResponse
object to provide success status and validation message; otherwise it can return nil
which will be interpreted as valid=true
# File lib/itly/plugin.rb, line 103 def validate(event:); end