users
collection. Nothing here is Mongo-only except Half 1 — the API calls in Half 2 are the same
for every database.
There are two halves that must agree. The API calls create the credit; the MongoDB connector
delivers it into your collection. The value that ties them together is
external_user_id.Half 1 — Connect MongoDB (delivery, one time)
Open Configuration → Integrations → Credit fulfilment, choose MongoDB, and fill in:
Then click Test connection — it should go healthy. (Test proves TrackRev can reach and read your
database; it does not exercise the match column, so also confirm the first real referral lands.)
The one rule that makes it work
Whatever you send asexternal_user_id in the API must equal the value stored in your
match_column. Pick one of these and stay consistent:
Match on _id
Set Match column to
_id and enroll users with their Mongo _id string as
external_user_id. TrackRev matches { _id: ObjectId(external_user_id) }.Match on email
Set Match column to
email and enroll users with their email as external_user_id.
TrackRev matches { email: external_user_id }._id ObjectId, a string id, or a numeric id automatically — the credit
field may be a number, or missing/null (it starts from 0). It just has to be the same identifier
on both sides.
Half 2 — Wire the API in your app
1. Install the pixel
_vid) alive across the visit.
2. Enroll each user to mint their referral link
referral_link to the user. (Or drop widget.js, which enrolls and renders a share card for
you.)
3. Report the signup when a referred friend joins
The friend clicks the link, lands on your site with?_vid=…, and you store it. When they create
their account, call:
_vid is the resolver, but you can also send
ref_code (the link slug) or referrer_external_user_id instead.
What happens automatically
TrackRev creates the credit grant, then the fulfilment cron runs the MongoDB connector against your collection:credits goes 0 → 50. No delivery code on your side.
Verify end to end
1
Enroll user A
Call
enroll for user A and copy the returned referral_link.2
Click + sign up as user B
Open the link in a private window (
?_vid=… appears in the URL), then sign up as B.3
Report B's signup
Your backend calls
report-signup with B’s id and the saved _vid.4
Check MongoDB
A’s
credits field has increased — proof the loop closed.
