Instead of `if; end; return; more stuff` leaving a return in the middle of the method, maybe do an if/else. Even better would be to collect the different options in each case with a single call to `client.track`.

Something like:

```ruby
if payload[:alert][:version] == 2
  data = payload[:violations].map { ... }
else
  data = get_measurements(payload).map { ... }
end

data.each { |user_id, event_data| client.track(user_id, event_name, event_data }
```

In Ruby, if you enumerate over an array of tuples, you can use them as arguments to the block directly:

```
>> arr = [[:a, 1], [:b, 2]]
>> arr.each { |a, b| puts "#{a} : #{b}" }
a : 1
b : 2
```

May be more trouble than its worth, but in any case we should avoid having a return in the middle of the method if we can help it.