Process Dec 29, 2017 5 min read

Intralot Crazy Freestyle Challenge — Technical Case Study

A deep-dive into the WordPress-based contest platform built for Intralot's Crazy Freestyle Challenge. This technical case study covers the custom theme architecture, AJAX-powered video gallery, multi-participant contest logic, instant-win ticket validation, and affiliate tracking integrations. Built with PHP 7, MySQL, Redis, and Docker, the platform supported a national tour across Italy with 388 commits over 3 years of development.

Lushano Perera
Lushano Perera
Author

Project Overview

Client: Intralot (Italian Lottery Operator) 
Agency: Arsenale23 
Developer: Lushano Perera 
Timeline: March 2016 – January 2019 
Type: Promotional Campaign & Contest Platform

The Crazy Freestyle Challenge was a multi-channel promotional campaign for Intralot, Italy’s leading lottery operator. The platform combined a football freestyle video contest with an instant-win lottery game, driving user engagement across digital and physical touchpoints through a national tour culminating in a grand finale event in Rome.


Technical Stack

LayerTechnologies
CMSWordPress 4.x
FrontendHTML5, SCSS/Compass, jQuery 1.11.2, Flickity, Fancybox, Superfish
BackendPHP 7.0, MySQL, Redis
Local DevDocker Compose (nginx + PHP-FPM + MySQL + Redis + phpMyAdmin)
DeploymentWordmove (rsync over SSH)
Version ControlGit (Bitbucket → GitLab migration)
IntegrationsYouTube API, Google API PHP Client, Zanox/Lovby lead tracking

Project Evolution

Phase 1: Foundation (March 2016)

Commits: 5537acd → 759d8b9

Initial project setup and HTML-to-WordPress conversion:

  • Static HTML prototype transitioned to WordPress theme
  • Base template structure established
  • Header with dropdown navigation implemented
  • Homepage sections built (categories, intro, hero)
5537acd first commit
76b3daf change: inizio base html
c8d8b88 change: prima fascia html home
759d8b9 change: rivistazione header con menu a tendina

Phase 2: Core Features (March-April 2016)

Commits: 9c8b831 → bd0a88b

Video gallery and user management systems:

  • Custom Post Type video with video-category taxonomy
  • AJAX-powered video pagination (48 videos per page)
  • YouTube video integration with auto-thumbnail fetching
  • User registration with ProfilePress plugin
  • WP Post Ratings integration for voting system
  • Custom user meta fields (tax number, phone, user type)
// Custom AJAX pagination handler
add_action('wp_ajax_ajax_pagination', 'my_ajax_pagination');
function my_ajax_pagination() {
$query_vars = array(
'post_type' => 'video',
'paged' => $_POST['page'],
'posts_per_page' => 48,
'tax_query' => array(...)
);
// ... WP_Query execution
}

Phase 3: Contest Logic (April 2016)

Commits: 694f2aa → 35b2944

Instant win game and contest mechanics:

  • Ticket code validation system for Intralot customers
  • User type differentiation (Freestyler Official/Crazy, Voter, Intralot Customer)
  • Custom hooks for instant win submissions (instant_win_submit)
  • Vote tracking with user meta timestamps

Phase 4: Tour & Events (May 2016)

Commits: 3c7775e → 6552559

National tour promotion pages:

  • Multi-city event showcase (Naples, Turin, Rome)
  • Tab-based navigation for tour dates
  • Image galleries for each venue
  • Freepass distribution system for finale event

Phase 5: Marketing Integrations (May 2016)

Commits: effa184 → 5c9dc03

Lead tracking and analytics:

  • Zanox affiliate tracking integration
  • Lovby lead tracking scripts
  • Registration event hooks for conversion tracking
  • Fallback logging for failed tracking calls
// Lead tracking trigger on registration
add_action('pp_after_registration', 'lead_tracking');
function lead_tracking() {
add_action('wp_footer', 'inline_lead_script');
function inline_lead_script() {
lovby_lead_script();
zanox_lead_script();
}
}

Phase 6: Contest Closure & Maintenance (May-October 2017)

Commits: 87a76b4 → 79a86c3

Post-campaign maintenance:

  • Contest closure messaging
  • Final content updates
  • Production synchronization
  • Minor bug fixes and image updates

Phase 7: Performance Optimization (January 2019)

Commits: 266cca6 → 4bc0a3f

Critical CSS and performance improvements:

  • Critical CSS extraction and inline loading
  • HTTP/2 detection for optimized asset delivery
  • Local development environment refinements

Architecture Deep Dive

Theme Structure

wp-content/themes/intralotcfc/
├── functions.php # Modular loader
├── inc/
│ ├── styles-scripts.php # Asset management with CDN fallback
│ ├── custom.php # AJAX handlers, user meta hooks
│ ├── setup.php # Theme supports, TinyMCE config
│ ├── menus.php # Navigation registration
│ └── branding.php # Login customization
├── acf_fields/
│ ├── youtube_chooser.php # Custom ACF YouTube selector
│ └── meride_textfield.php # Meride video integration
├── parts/ # Reusable template components
├── sass/ # SCSS source files (1,681 lines)
└── tp_*.php # Page templates (12 templates)

Page Template System

TemplatePurpose
tp_homepage.phpLanding page with contest categories
tp_concorso.phpContest rules and category selection modals
tp_instantwin.phpTicket validation form for lottery customers
tp_videogallery.phpAJAX-paginated video grid with voting
tp_tour.phpMulti-city event showcase with tabs
tp_prizes.phpPrize catalog organized by participant type
tp_profile.phpUser profile management
tp_finals.phpFinal event and results

Custom User Fields

Extended WordPress user meta for contest requirements:

  • user_type: Participant category (freestyler/voter/intralot customer)
  • user_taxnumber: Italian fiscal code (sanitized on save)
  • user_cellphone: Mobile phone for prize notifications
  • user_won: Winner flag for instant win
  • latest_vote_video: Timestamp of last vote
  • latest_instant_win: Timestamp of last instant win attempt

Frontend JavaScript Architecture

// Main.js Feature Modules
├── Superfish dropdown menus (responsive)
├── Smooth scroll navigation
├── Modal system for contest categories
├── Fancybox lightbox integration
├── Flickity carousels (documentary, how-to)
├── Tour date tab navigation
├── Mobile menu toggle
├── Lead tracking functions (Lovby/Zanox)
└── AJAX video pagination

Development Workflow

Local Environment

Docker Compose stack for isolated development:

services:
nginx: # Reverse proxy with image fallback to production
php: # PHP 7.0-FPM with Redis extension
mysql: # Database with seeded contest data
redis: # Object caching layer
phpmyadmin: # Database management UI

Multi-Environment Configuration

wp-config.php auto-detects environment:

if ($_SERVER['HTTP_HOST'] == 'www.intralotcfc.it.local') {
define('DB_HOST', 'mysql'); // Docker container
} elseif ($_SERVER['HTTP_HOST'] == 'dev.vincentisidiventa.it') {
// Staging credentials
} else {
// Production credentials
}

Deployment Pipeline

Wordmove configuration for three environments:

# Deploy theme changes to production
wordmove push -e production -t

# Sync database from production to local
wordmove pull -e production -d

Key Metrics

MetricValue
Total Commits388
PHP Files (Theme)200
SCSS Lines1,681
Page Templates12
Development Duration~3 years
Contributors2 (Lushano Perera: 300 commits, Giovanni Dragone: 88 commits)

Notable Technical Achievements

1. Multi-Participant Contest System

Single platform supporting four distinct user journeys with different rules, prizes, and validation logic.

2. Real-Time Ticket Validation

Integration with Intralot’s lottery backend for instant-win game mechanics using ticket codes.

3. Performance-Optimized Frontend

  • Critical CSS inline loading with HTTP/2 detection
  • Deferred script loading for non-critical JavaScript
  • CDN failover for jQuery with local fallback
  • Redis object caching for database query optimization

4. Lead Tracking Integration

Dual affiliate tracking (Zanox + Lovby) with fallback logging for conversion attribution.

5. Custom ACF Field Types

YouTube and Meride video selectors with Google API integration for video metadata fetching.


Plugins Ecosystem

PluginPurpose
Advanced Custom FieldsCustom meta boxes for video data
ProfilePressUser registration with social login
WP Post RatingsVideo voting system
Contact Form 7Support forms
Cookie NoticeGDPR compliance
Yoast SEOSearch optimization
Redis CachePerformance caching
Postman SMTPTransactional email delivery

Lessons Learned

  1. Modular Theme Architecture: Splitting functions.php into focused includes improved maintainability across the long project lifecycle.
  2. Environment Parity: Docker-based local development eliminated “works on my machine” issues across team members.
  3. Wordmove for WordPress: Rsync-based deployment provided reliable, incremental updates compared to FTP-based workflows.
  4. Custom User Meta Strategy: Extending WordPress users with contest-specific fields avoided the complexity of separate participant tables.
  5. Critical CSS Strategy: Inline critical CSS with HTTP/2 detection provided optimal performance across connection types.

Written by Lushano Perera

Digital craftsman exploring the intersection of design, technology, and human experience.