Module: Seekmodo::Sdk::Events::ClickBeacon
- Defined in:
- lib/seekmodo/sdk/events/click_beacon.rb
Constant Summary collapse
- SURFACE_SERP =
"serp"- SURFACE_TYPEAHEAD =
"typeahead"- SURFACE_RECOMMENDATIONS =
"recommendations"
Class Method Summary collapse
- .click(query, doc_id, position, is_bot, surface: SURFACE_SERP, shopper_context: nil, extra: nil) ⇒ Object
- .impression(query, doc_ids, is_bot, surface: SURFACE_SERP, shopper_context: nil, extra: nil) ⇒ Object
- .search(query, hits, is_bot, shopper_context: nil, extra: nil) ⇒ Object
Class Method Details
.click(query, doc_id, position, is_bot, surface: SURFACE_SERP, shopper_context: nil, extra: nil) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/seekmodo/sdk/events/click_beacon.rb', line 13 def click(query, doc_id, position, is_bot, surface: SURFACE_SERP, shopper_context: nil, extra: nil) event = { "type" => "click", "q" => query, "doc_id" => doc_id, "position" => position, "is_bot" => is_bot, "surface" => surface, "ts" => Time.now.to_i } event["shopper"] = shopper_context if shopper_context event.merge!(extra) if extra event end |
.impression(query, doc_ids, is_bot, surface: SURFACE_SERP, shopper_context: nil, extra: nil) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/seekmodo/sdk/events/click_beacon.rb', line 28 def impression(query, doc_ids, is_bot, surface: SURFACE_SERP, shopper_context: nil, extra: nil) event = { "type" => "impression", "q" => query, "doc_ids" => doc_ids.dup, "is_bot" => is_bot, "surface" => surface, "ts" => Time.now.to_i } event["shopper"] = shopper_context if shopper_context event.merge!(extra) if extra event end |
.search(query, hits, is_bot, shopper_context: nil, extra: nil) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/seekmodo/sdk/events/click_beacon.rb', line 42 def search(query, hits, is_bot, shopper_context: nil, extra: nil) event = { "type" => "search", "q" => query, "hits" => hits, "is_bot" => is_bot, "surface" => SURFACE_SERP, "ts" => Time.now.to_i } event["shopper"] = shopper_context if shopper_context event.merge!(extra) if extra event end |