=== Perkadoo ===
Contributors: perkadoo
Tags: giveaway, contest, streak, gamification, learndash
Requires at least: 6.3
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Put your Perkadoo giveaway, streak and perk widgets on any page, and turn LearnDash lessons into streaks.

== Description ==

More new faces. More familiar ones.

Perkadoo gives creators and small online brands giveaways that bring people in, streaks that bring them back and perks that make it worth it. This plugin puts those widgets on your WordPress site. You build them in Perkadoo, then drop a shortcode where you want them.

**Giveaway banner**

`[perkadoo_giveaway slug="your-giveaway"]`

Shows your hosted giveaway: the prize, a countdown, the entry count and an Enter button. Visitors enter right there, and it shows the winners once you draw. Each entrant gets an invite link and a share card, so their friends find you too.

**Streak widget**

`[perkadoo_streak]`

A daily streak your visitors keep alive by checking in. It shows their streak, this week and the next milestone.

**LearnDash lesson streaks**

Paste a connection code from Perkadoo into Settings > General. Every lesson a signed-in student finishes counts once toward their daily streak, and `[perkadoo_streak]` shows signed-in students their own lesson streak. Milestones can unlock perks, like a bonus resource at 7 days.

**Perk toast**

`[perkadoo_perk]`

Pops up when someone hits a milestone and unlocks a perk you set up.

**Options**

* `variant` sets the giveaway banner's style: `card` (default, sits where you put it), `bar` or `pill`.
* `position` sets where a bar, pill, streak widget or toast floats, such as `bottom` or `bottom-left`.
* `action` picks the streak's action when it isn't the default `visit`.

You can use the Shortcode block in the block editor, or paste the shortcode into any classic editor, widget or page builder.

**What you need**

A Perkadoo account. The free plan covers streaks for up to 100 members a month. It also runs one live giveaway at a time with up to 250 entrants; paid plans run more. The giveaway banner needs only the giveaway's link name. The streak widget and perk toast need your project key in Settings > General.

== External services ==

This plugin shows widgets from Perkadoo, a service run by the plugin's authors. It can't show anything without it. Nothing loads on a page until you add a Perkadoo shortcode to it.

**cdn.perkadoo.com (widget files)**

On pages with a Perkadoo shortcode, the visitor's browser loads https://cdn.perkadoo.com/v1/widget.js and the scripts, fonts and images it uses from the same host. As with any web request, the CDN sees the visitor's IP address and browser user agent. `widget.js` is the Perkadoo service's own client. It isn't bundled with the plugin because it updates with the service.

**api.perkadoo.com (widget data)**

* The giveaway banner loads the giveaway's public details by its link name. When a visitor enters, it sends the email address they type, their consent choices and the invite code from the link they arrived by, if any. Entering needs their agreement to your official rules. Marketing consent is a separate, optional box.
* The streak widget and perk toast send your project key, the action and a random visitor ID kept in the visitor's browser. A check-in sends the same, with the time. WordPress user names and email addresses are not sent.
* With a LearnDash connection, your server sends each finished lesson to https://api.perkadoo.com/v1/webhook/: your project key, the program's action, a pseudonymous member ID the plugin derives from the WordPress user ID with a secret salt, a stable event ID and the time. Signed-in students' browsers fetch a short-lived signed identity from your own site (/wp-json/perkadoo/v1/identity) and send it with the widget's requests. User IDs, names and email addresses never leave your site.

**app.perkadoo.com (LearnDash connection)**

* When you save a connection code, your server sends the code and your site's address to redeem it, and receives the program's keys.
* While the program is in test mode, your server asks at most every 15 minutes whether it has gone live, sending the project key, action and webhook secret.

Without a LearnDash connection, the plugin sends nothing from your server.

Perkadoo terms of service: https://perkadoo.com/terms
Perkadoo privacy policy: https://perkadoo.com/privacy

== Installation ==

1. In WordPress, go to Plugins > Add New Plugin, search for "Perkadoo", then install and activate it.
2. For a giveaway, copy the last part of your giveaway's link in Perkadoo (perkadoo.com/g/**your-giveaway**). Add `[perkadoo_giveaway slug="your-giveaway"]` to a page.
3. For streaks and perks, copy your project key from Perkadoo, paste it into Settings > General > Perkadoo project key, and save. Add `[perkadoo_streak]` or `[perkadoo_perk]` to a page.
4. For LearnDash, choose WordPress in your Perkadoo setup, copy the connection code and paste it into Settings > General > Perkadoo LearnDash streak.

== Frequently Asked Questions ==

= Does it cost anything? =

The plugin is free. Perkadoo's free plan covers streaks for up to 100 members a month. It runs one live giveaway at a time with up to 250 entrants; paid plans run more. See https://perkadoo.com/pricing.

= Where do I find my project key? =

In your Perkadoo dashboard, under Settings. It's safe to show in a web page.

= What visitor data is sent to Perkadoo? =

A random visitor ID from the visitor's browser, and for giveaway entries, the email address the visitor types. See External services for every request.

= Does it slow my site down? =

The widget script loads deferred in the footer, and only on pages with a Perkadoo shortcode.

= Which LearnDash lessons count? =

Every lesson a signed-in student finishes, in any course. Each lesson counts once per student and course.

= When are lessons sent? =

Right after the lesson page finishes, through WP-Cron, so students never wait. Failed sends retry for about an hour. WP-Cron runs on site traffic, so set up a server cron on quiet sites.

= What happens when I delete the plugin? =

Deleting it removes the project key and the LearnDash connection from your database.

== Screenshots ==

1. A giveaway banner card on a page, open for entries.
2. The streak widget with a visitor's streak and this week.
3. The project key and LearnDash connection fields in Settings > General.

== Changelog ==

= 1.0.0 =
* Giveaway banner, streak widget and perk toast shortcodes.
* LearnDash lesson streaks with one connection code.

== Upgrade Notice ==

= 1.0.0 =
First release on WordPress.org.
