Sha256: 7947e8f98fae13adaa338313caaa373eadb00469956e98718fc10384cf88a82d

Contents?: true

Size: 1.21 KB

Versions: 6

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: true

require_relative "../lib/absmartly"

# config file
Absmartly.configure_client do |config|
  config.endpoint = "https://demo.absmartly.io/v1"
  config.api_key = "x3ZyxmeKmb6n3VilTGs5I6-tBdaS9gYyr3i4YQXmUZcpPhH8nd8ev44NoEL_3yvA"
  config.application = "www"
  config.environment = "prod"
end

# define a new context request
context_config = Absmartly.create_context_config
context_config.set_unit("session_id", "bf06d8cb5d8137290c4abb64155584fbdb64d8")
context_config.set_unit("user_id", "123456")

ctx = Absmartly.create_context(context_config)

treatment = ctx.treatment("exp_test_ab")
puts(treatment) # 0
treatment1 = ctx.treatment("net_seasons")
puts(treatment1) # 1
treatment2 = ctx.treatment("Experimento!")
puts(treatment2) # 1
treatment3 = ctx.treatment("test")
puts(treatment3) # 1

ctx.set_unit("db_user_id", 1000013)
ctx.set_units(db_user_id2: 1000013, session_id2: 12311)

ctx.set_attribute("user_agent", "Chrome 2022")
ctx.set_attributes(
  customer_age: "new_customer",
  customer_point: 20,
)

ctx.set_override("new_exp", 3)
ctx.set_overrides(
  exp_test_experiment: 1,
  exp_another_experiment: 0,
)
ctx.publish
properties = {
  value: 125,
  fee: 125
}
ctx.track("payment", properties)

ctx.close

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
absmartly-sdk-1.1.1 example/example.rb
absmartly-sdk-1.1.0 example/example.rb
absmartly-sdk-1.0.8 example/example.rb
absmartly-sdk-1.0.7 example/example.rb
absmartly-sdk-1.0.6 example/example.rb
absmartly-sdk-1.0.5 example/example.rb