Someone want to write some code for me? (SOLVED)

I’ve spent some time looking for a metered paywall solution for Ghost. All the ones I looked at wanted to handle everything: paywall, membership, emails, and so on. And most of them were way expensive.

All I need is a very simple metered paywall. If I knew Javascript, I’d write it myself – but I don’t. So, I’m looking for someone to write it … and depending on the cost, I’d even pay real cash money. :wink:

The goal is a script that checks to see if the browser in use has read three stories on the site in the past 30 days, and if so, prevent reading further and throw up a dialog of explanation, with some sort of CTA linked to the subscribe page. The script would go in post.hbs, and be triggered whenever someone opened an article. Here’s the pseudocode:

DIM cookie_date as date
DIM cookie_read_count as integer
DIM dialog.text as text

dialog.text = "Thanks for reading stories on our site! We allow
non-members to read three stories a month, and it appears
you have reached that limit. To get FULL access to all
stories, sign up for a FREE membership."

IF logged_in
     EXIT
ENDIF

IF cookie-exist = FALSE
    CREATE cookie
    SET cookie_date = TODAY
    SET cookie_read_count = 1
    EXIT
ELSE
    IF cookie_date < (TODAY-30)
        SET cookie_date = TODAY
        SET cookie_read_count = 1
        EXIT
    ELSE
        SELECT CASE
        CASE cookie_read_count = 1
            SET cookie_read_count = 2
            EXIT
        CASE cookie_read_count = 2
            SET cookie_read_count = 3
            EXIT
        CASE cookie_read_count = 3
            Blank/Shade remaining content
            Display dialog
            Display CTA
        ENDCASE
    ENDIF
ENDIF
            

As I said, I don’t think it’s a tremendously hard script, but I don’t have time to learn Javascript and write it myself.

Any takers or ideas?

Hello @BruceInLouisville, I just sent you a private message.

Cheers,
Eric

Kudos to Eric! He wrote up exactly what I outlined, and in just a few days. Installed it, and it works like a charm.

If any of you are looking for a metered paywall for your site, reach out to Eric. Good work!

1 Like

Hey @ericalli , is this still some code you’d be willing to write? I’ve needed a metered paywall solution and it sounds like you might figured it out.