Maintainers
Pricing
Enterprise
More
More
Documentation
Try Live
Rankings
Install
Blog
Docs7
Ask
New
Add Docs
RafflePress
https://rafflepress.com/docs/
Admin
Documentation, Reference Materials, and Tutorials for RafflePress.
Tokens:
8,386
Snippets:
190
Trust Score:
10
Update:
4 months ago
Context
Chat
Benchmark
Latest
Show doc for...
Code
Info
Show Results
Tokens:
Raw
Copy
Link
Tokens:
Raw
Copy
Link
### Complete Entry Programmatically Source: https://rafflepress.com/docs/complete-action-or-add-user-programmatically This code snippet allows you to programmatically complete a user's entry for a RafflePress giveaway. It requires the giveaway ID, action ID, and the user's email. ```php <?php /** * Plugin Name: Complete Entry Programmatically * Description: Completes a user's entry for a RafflePress giveaway programmatically. * Version: 1.0 * Author: RafflePress */ add_action( 'init', function() { // Replace with your actual giveaway and action IDs $giveaway_id = 123; // Example Giveaway ID $action_id = 456; // Example Action ID $email = 'user@example.com'; // Example User Email // Check if RafflePress is active if ( ! class_exists( 'RafflePress' ) ) { return; } // Complete the user's entry RafflePress ->actions() ->complete_entry( $giveaway_id, $action_id, $email ); } ); ``` -------------------------------- ### Add User Programmatically Source: https://rafflepress.com/docs/complete-action-or-add-user-programmatically Use this code to programmatically add a user to a RafflePress giveaway. Ensure you have the giveaway ID, action ID, and user's email. ```php <?php /** * Plugin Name: Add User Programmatically * Description: Adds a user to a RafflePress giveaway programmatically. * Version: 1.0 * Author: RafflePress */ add_action( 'init', function() { // Replace with your actual giveaway and action IDs $giveaway_id = 123; // Example Giveaway ID $action_id = 456; // Example Action ID $email = 'user@example.com'; // Example User Email // Check if RafflePress is active if ( ! class_exists( 'RafflePress' ) ) { return; } // Check if the user already exists (optional) if ( email_exists( $email ) ) { // User already exists, handle accordingly return; } // Add the user to the giveaway RafflePress ->actions() ->add_user( $giveaway_id, $action_id, $email ); } ); ``` -------------------------------- ### Exclude Giveaway URL from CDN Page Rules Source: https://rafflepress.com/docs/quick-troubleshooting-tips Use this pattern in CDN page rules to exclude specific giveaway URLs from being served by the CDN. This ensures integration actions are processed correctly. ```url https://yourwebsite.com/?rpid=* ``` -------------------------------- ### Trigger Google Analytics Event Source: https://rafflepress.com/docs/goal-tracking Use this script in the 'Conversion Scripts' section to trigger a 'joined_list' event in Google Analytics when a user subscribes to a giveaway. Ensure your Google Analytics tracking code is correctly set up. ```javascript <script>gtag('event', 'joined_list', {'event_label': 'Giveaway Subscribed','event_category': 'giveaway'});</script> ```