Distance Between Points Within

Prev Next

Find The: Distance Between Points Within Image

distance_between_points_within

Statistics of the distance between two locations within the same event, calculated for multiple events matching the criteria.

For example:

  • The distance between Primary and DNS IP address locations for this event.
  • The standard deviation of the distance between WEBRTC and PRIMARY IP address locations across past events.
  • The distance between shipping and billing addresses.
  • The distance between an address attribute and an IP address attribute.

Distance Between Points Within: two coordinates measured inside each event

Configuration

  • Feature Name: The "dictionary" name under which the feature value will be stored and referenced by in rules.
  • Comparing: The two coordinate attributes, or "points", to measure between for each event. Both must have the Coordinate data type. In YAML these are coordinate and and.
  • In Units: kilometers or miles. Required.
  • For Events:
    • With The Same: Provides a way of filtering past events based on the attribute values. There must be at least one Identifier and only Identifier and Subject attributes can be used.
  • Into Features: Distance Between Points Within can calculate multiple statistics from a single configuration and output them to the Feature Names given. Fill in the Feature Name for each statistic required and leave the rest blank. Every statistic you want needs its own Feature Name.

Optional Configuration

  • Default Value: A value that can be assigned to the feature if the attributes to calculate the features are not present.
  • Scope: Can be used to extend the event search from the local node, to all nodes within the same organization all the way to all across customers (global).
  • For Events:
    • All event types: Default, no filter
    • Same as current: Filter by event_type of event being processed
    • Specific event type: List out the event_type to restrict to, as a list. Example: only consider account_login_success.
  • Condition: A Query-Language filter that can be used to refine Features for specific use cases.
  • Time Window: Can be used to limit the Feature calculation to a specific time period/window. e.g 1 week. Default is all ; no time window
  • Starting: Can be used to remove recent events from Feature calculation. Default is immediately ; no lag.

Use Case 1

Measure the distance between the shipping and billing addresses given on a checkout, and average it across this customer's checkouts. A shipping address that sits a long way from the billing address on every order is a reshipping pattern; one distant delivery on its own is not.

  • Both attributes must hold a Coordinate. The address attributes carry one under geocoding.
  • With The Same is the customer token, so the average covers this customer's own checkouts and nobody else's.
  • The event type is restricted to checkout, so browsing and login events are not averaged in.
  • No default value is set. If a checkout carries only one of the two addresses that checkout contributes nothing, which prevents a missing address reading as a distance of zero.

Using the Feature in Rules and Investigations

Find customers whose shipping address is on average more than 100 kilometers from their billing address.

feature('ship_bill_dist_avg') >= 100.0

Implementing In The Feature Editor

The Feature Summary
image.png

The Feature Editor
image.png

image.png

image.png

  - name: ship_bill_dist
    default_value: null
    time_window: all
    starting: immediately
    find_the:
      distance_between_points_within:
        events:
          event_type:
            - checkout
          include_current_event: true
          with_the_same:
            - identity['ACCOUNT'].customer_token.customer_token
        coordinate: identity['SHIPPING'].address['HOME'].geocoding.coordinate
        and: identity['BILLING'].address['HOME'].geocoding.coordinate
        in_units: kilometers
        into_features:
          average: ship_bill_dist_avg
    with_scope: same_node_instance