Tracking referrals? Encouraging users to invite others?


(Shaun Defense) #1

I’m looking for ways to grow my site. We are close to 1000 members but we just hit a slump in growth.

We plan on doing a contest of some type but we want to make sure the contest encourages further growth. We thought about doing a contest: Whoever invites the most active users in 30 days wins.

This could be effective but the problem is I don’t see any admin overview of signups via invite or sitewide user activity, so it would be difficult to track.

Does anyone know of a way we can track invites and user activity sitewide?


(Felix Freiberger) #2

This is something for the Data Explorer plugin, it allows you to run custom SQL queries against the Discourse database.

If you’re somewhat versed in SQL, using Data Explorer is pretty easy since it has included help to show you the database scheme; otherwise, I’m sure you’ll get some help here if you describe what you want, exactly :slight_smile:


#3

As @fefrei said, you can use Data Explorer with a query like this:

-- [params]
-- int :limit

select user_id, 
    invited_by_id
from invites
where created_at > CURRENT_TIMESTAMP - INTERVAL '30 days'
and user_id > 1
limit :limit

And modify that query with more complex query if you want.
See this queries’s directory that you can use

Good luck !

Ps, updated: I added tracking-referrals.sql to the list :wink:


(Shaun Defense) #4

Thanks for the help!


(Henry Cooper) #5

I tried running this and got a syntax error “at or around line 25”


#6

Henry, on that link there are two queries. Which version are you trying ?
I tested the both now, and works fine. :thinking:


(Henry Cooper) #7

Oops. Didn’t notice there was two. I ended up copy pasting both thinking it was one.

Problem solved :slight_smile: