SweepWidget Help Docs

Auto-Enter User From Your Website’s Logged In User Session / Cookie Data


Premium plan is required for this feature.

In this article, we will learn how to auto-login a user with pre-filled data from your website. You can auto-fill the name, email, and whether or not to auto-log them in.

Example of how this works:

If a user a logged into your website and hasn’t entered a SweepWidget giveaway yet, you can auto-fill the name/email. You would be pulling this data from the session data on your website and populating the SweepWidget form with it. Furthermore, you can automatically have them enter the giveaway with this name/email combination.

Implementation instructions:

You will need to add 3 parameters to the embed code for your giveaway.

Here’s an example embed code:

<div id="29218-9c7ong3k" class="sw_container"><script type="text/javascript" src="https://sweepwidget.com/w/j/w_init.js?v=3"></script></div>

You would need to add the following 3 parameters:

data-email-prefill="[email protected]"
data-name-prefill="John Doe"
data-auto-login-prefill="1"

The values to each of these parameters would be pulled from your session or cookie data. Here’s an example implementation using PHP:

<div id="29218-9c7ong3k" class="sw_container" data-name-prefill="Test" data-email-prefill="[email protected]" data-auto-login-prefill="1"><script type="text/javascript" src="https://sweepwidget.com/w/j/w_init.js?v=3"></script></div>

Also, you can set data-auto-login-prefill to either 1 or 0. If it’s set to 1 it will auto-log them in. If it’s set to 0, it won’t.

How to auto-log user in on hosted landing page with URL parameters?

You can also pass the name, email, and whether or not to auto-log a user in by passing specific parameters of the URL address bar on your hosted SweepWidget landing page. You simply need to pass the following 3 parameters:

data-name

data-email

data-auto-login (use 1 for yes and 0 for no)

Example link:

https://sweepwidget.com/c/438-tu2zjsh4?data-name=Steven&[email protected]&data-auto-login=0