Class: Itly::Plugin

Inherits:
Object
  • Object
show all
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

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).

Parameters:

  • user_id: (String)

    The ID that the user will be identified by going forward.

  • previous_id: (String)

    The ID the user has been identified by so far.

  • options: (Itly::PluginCallOptions) (defaults to: nil)

    plugin specific option.



76
# File 'lib/itly/plugin.rb', line 76

def alias(user_id:, previous_id:, options: nil); end

#flushObject

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.

Parameters:

  • user_id: (String)

    the id of the user in your application

  • group_id: (String)

    the id of the group in your application

  • properties: (Hash) (defaults to: nil)

    the properties to pass to your application

  • options: (Itly::PluginCallOptions) (defaults to: nil)

    plugin specific option.



39
# File 'lib/itly/plugin.rb', line 39

def group(user_id:, group_id:, properties: nil, options: nil); end

#idString

Get the plugin ID, which is the underscored class name. Use only the child class in case of nested classes

Returns:

  • (String)

    plugin id



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.

Parameters:

  • user_id: (String)

    the id of the user in your application

  • properties: (Hash) (defaults to: nil)

    the properties containing user’s traits to pass to your application

  • options: (Itly::PluginCallOptions) (defaults to: nil)

    plugin specific options.



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.

Parameters:



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.

Parameters:

  • user_id: (String)

    the id of the user in your application

  • category: (String) (defaults to: nil)

    the category of the page

  • name: (String) (defaults to: nil)

    the name of the page.

  • properties: (Hash) (defaults to: nil)

    the properties to pass to your application

  • options: (Itly::PluginCallOptions) (defaults to: nil)

    plugin specific option.



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

#resetObject

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

#shutdownObject

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

Parameters:

  • user_id: (String)

    the id of the user in your application

  • event: (Event)

    the events to track

  • options: (Itly::PluginCallOptions) (defaults to: nil)

    plugin specific option.



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