Method: Mints::Pub#register_visit

Defined in:
lib/pub.rb

#register_visit(request, ip = nil, user_agent = nil, url = nil) ⇒ Object

Register Visit.

Register a ghost/contact visit in Mints.Cloud

Parameters

  • request - [ActionDispatch::Request] request

  • ip - [String] It’s the visitor IP

  • user_agent - The visitor’s browser user agent

  • url - [String] URL visited


58
59
60
61
62
63
64
65
66
# File 'lib/pub.rb', line 58

def register_visit(request, ip = nil, user_agent = nil, url = nil)
  data = {
    ip_address: ip || request.remote_ip,
    user_agent: user_agent || request.user_agent,
    url: url || request.fullpath
  }
  response = @client.raw("post", "/register-visit", nil, data.to_json)
  return response
end