To run giveaways on your domain, you need to load the TrustPrize script from your website's source code. The script will render the opt-in forms for your giveaways and will also confirm that you are, in fact, the true owner of your domain address.

  • We ask that your website is served on https:// and not on http://. This is a basic requirement that protects participants and their personal data.

  • This script must be installed at the root of your account's domain address but also on every sub-page where you want your giveaways to be shown!

  • When publishing a giveaway, we check your domain to ensure the script is installed correctly (at the root URL).

Here's what you need to do...

1. Install the script on your website

Place the following code in the <head>…</head> section of your website.

<script src="https://trustprize.com/script.js?account=#ACCOUNT_ID" async></script>
  • Replace #ACCOUNT_ID with your account's ID (see Company Profile page).

  • The form data is encrypted before being sent over the wire.

  • It's loaded asynchronously so it won't affect your website's loading process.

  • It doesn't use <iframe> and it doesn't conflict with your own CSS styles.

  • You can control when the form is displayed from the competition's settings.

2. Adjust your CSP rules

If you have Content Security Policy configured for your website (recommended), then you must append the following values to your existing CSP rules to allow required content from https://*.trustprize.com to be loaded properly (also reCaptcha content).

script-src https://trustprize.com https://*.trustprize.com https://www.google.com/recaptcha/ https://www.gstatic.com/recaptcha/;
img-src https://trustprize.com https://*.trustprize.com;
font-src https://trustprize.com https://*.trustprize.com;
connect-src https://trustprize.com https://*.trustprize.com;
frame-src https://www.google.com/recaptcha/;
  • These values must be appended to your existing CSP rules.

  • If you don't use CSP on your website then you can ignore this step entirely.

3. Done.

To check the integration, go to Company Profile page and click the "Check now" button next to your domain address. It should show a green check-mark on success.

Other considerations

Additional Custom Landing Page embedding code

When selecting the Custom Landing Page goal, you have to inject a small code for that giveaway in your custom page.

Just place the following code where you'd like the opt-in form to be shown and the TrustPrize script will automatically detect it and will replace it with the appropriate content on page-load.

<div data-vendor="TrustPrize" data-certificate="#CERTIFICATE_ID"></div>

Notes:

  • Replace #CERTIFICATE_ID with the actual certificate ID you whish to embed.

  • The opt-in form will simply center itself within the provided element.

  • To get the certificate ID, open the giveaway from the Dashboard and click on the "Details" tab; you'll find the ID on the first line at the top.

Show or hide the popup opt-in form programmatically

If you're in a position where you'd like explicit control over when the opt-in form is shown or hidden, you can use the dedicated static methods from the TrustPrize bject to trigger the currently active popup competition (if any).

// Show the opt-in form.
window.TrustPrize.show();

// Hide the opt-in form.
window.TrustPrize.hide();

Notes:

  • You can only have a single Pop-up Box competition running at any given time.

  • You can have any number of competitions running if using other goals.

Did this answer your question?