Sign up

Revenue

Link users to visits

After a user signs in, your backend links your own stable user ID to the browser's visitor ID.

Identify a user

  1. Read the visitor ID in the browser

    Call window.analytics.getVisitorId() and send the result to your backend with the signed-in request.

  2. Call Identify from your backend

    Set METRICRAVEN_SECRET_KEY in your server environment first. Use your own user ID, not a MetricRaven dashboard account ID.

    Server terminal · replace example values
    curl --request POST 'https://metricraven.com/api/v1/identify' \
      --header "Authorization: Bearer $METRICRAVEN_SECRET_KEY" \
      --header 'Content-Type: application/json' \
      --data '{
      "visitor_id": "0123456789abcdef0123456789abcdef",
      "user_id": "user_42",
      "email": "ana@example.com",
      "name": "Ana"
    }'
  3. Reuse the same user ID everywhere

    Use the same user ID in your payment provider metadata and server events.

Verify it works

In Traffic, open Visitors for a period that includes the visit and search for the user's email or your user ID. Their journey joins visits, goals and payments.

Details

  • getVisitorId() can return null until the first collection request completes. Retry after the browser's analytics:visitor event, or defer linking until an ID is available.
  • Don't send the literal example visitor ID.
  • Email and name are optional.
  • The browser supplies the visitor ID; your backend supplies the authenticated user ID. Never trust a user ID sent from the browser.