Class: Itly::Plugin
- Inherits:
-
Object
- Object
- Itly::Plugin
- Defined in:
- lib/itly/plugin.rb
Overview
Parent class for all plugins
When creating a custom plugin, you need to create a child class of Itly::Plugin
Instance Method Summary collapse
-
#alias(user_id:, previous_id:, options: nil) ⇒ Object
Associate one user ID with another (typically a known user ID with an anonymous one).
-
#flush ⇒ Object
Flush data.
-
#group(user_id:, group_id:, properties: nil, options: nil) ⇒ Object
Associate a user with their group (for example, their department or company), or to set the group’s traits.
-
#id ⇒ String
Get the plugin ID, which is the underscored class name.
-
#identify(user_id:, properties: nil, options: nil) ⇒ Object
Identify a user in your application and associate all future events with their identity, or to set their traits.
-
#load(options:) ⇒ Object
Called when the Itly SDK is being loaded and is ready to load your plugin.
-
#page(user_id:, category: nil, name: nil, properties: nil, options: nil) ⇒ Object
Let record page views, along with optional extra information about the page viewed by the user.
- #post_alias(user_id:, previous_id:) ⇒ Object
- #post_group(user_id:, group_id:, properties:, validation_results:) ⇒ Object
- #post_identify(user_id:, properties:, validation_results:) ⇒ Object
- #post_page(user_id:, category:, name:, properties:, validation_results:) ⇒ Object
- #post_track(user_id:, event:, validation_results:) ⇒ Object
-
#reset ⇒ Object
Reset the SDK’s (and all plugins’) state.
-
#shutdown ⇒ Object
Stop all processes and free resources.
-
#track(user_id:, event:, options: nil) ⇒ Object
Track an event, call the event’s corresponding function.
-
#validate(event:) ⇒ Object
Validate an Event.
Instance Method Details
#alias(user_id:, previous_id:, options: nil) ⇒ Object
Associate one user ID with another (typically a known user ID with an anonymous one).
76 |
# File 'lib/itly/plugin.rb', line 76 def alias(user_id:, previous_id:, options: nil); end |
#flush ⇒ Object
Flush data
83 |
# File 'lib/itly/plugin.rb', line 83 def flush; end |
#group(user_id:, group_id:, properties: nil, options: nil) ⇒ Object
Associate a user with their group (for example, their department or company), or to set the group’s traits.
39 |
# File 'lib/itly/plugin.rb', line 39 def group(user_id:, group_id:, properties: nil, options: nil); end |
#id ⇒ String
Get the plugin ID, which is the underscored class name. Use only the child class in case of nested classes
110 111 112 113 114 |
# 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(user_id:, properties: nil, options: nil) ⇒ Object
Identify a user in your application and associate all future events with their identity, or to set their traits.
26 |
# File 'lib/itly/plugin.rb', line 26 def identify(user_id:, properties: nil, options: nil); end |
#load(options:) ⇒ Object
Called when the Itly SDK is being loaded and is ready to load your plugin.
16 |
# File 'lib/itly/plugin.rb', line 16 def load(options:); end |
#page(user_id:, category: nil, name: nil, properties: nil, options: nil) ⇒ Object
Let record page views, along with optional extra information about the page viewed by the user.
52 |
# File 'lib/itly/plugin.rb', line 52 def page(user_id:, category: nil, name: nil, properties: nil, options: nil); end |
#post_alias(user_id:, previous_id:) ⇒ Object
78 |
# File 'lib/itly/plugin.rb', line 78 def post_alias(user_id:, previous_id:); end |
#post_group(user_id:, group_id:, properties:, validation_results:) ⇒ Object
41 |
# File 'lib/itly/plugin.rb', line 41 def post_group(user_id:, group_id:, properties:, validation_results:); end |
#post_identify(user_id:, properties:, validation_results:) ⇒ Object
28 |
# File 'lib/itly/plugin.rb', line 28 def post_identify(user_id:, properties:, validation_results:); end |
#post_page(user_id:, category:, name:, properties:, validation_results:) ⇒ Object
54 |
# File 'lib/itly/plugin.rb', line 54 def post_page(user_id:, category:, name:, properties:, validation_results:); end |
#post_track(user_id:, event:, validation_results:) ⇒ Object
67 |
# File 'lib/itly/plugin.rb', line 67 def post_track(user_id:, event:, validation_results:); end |
#reset ⇒ Object
Reset the SDK’s (and all plugins’) state. This method is usually called when a user logs out.
93 |
# File 'lib/itly/plugin.rb', line 93 def reset; end |
#shutdown ⇒ Object
Stop all processes and free resources.
88 |
# File 'lib/itly/plugin.rb', line 88 def shutdown; end |
#track(user_id:, event:, options: nil) ⇒ Object
Track an event, call the event’s corresponding function.
See Itly#track for more information
65 |
# File 'lib/itly/plugin.rb', line 65 def track(user_id:, event:, options: nil); end |
#validate(event:) ⇒ Object
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
103 |
# File 'lib/itly/plugin.rb', line 103 def validate(event:); end |