Update Summary: Independent Ad Banner Products
Update Summary: Independent Ad Banner Products
Problem
When multiple affiliate ad banners appeared on the same page, they all displayed the same products because the product selection logic used the same scoring criteria and rotation seed.
Solution
Implemented a block_id parameter system that allows each affiliate block to independently select different products while maintaining the same relevance criteria (terrain, season, race keywords).
Changes Made
1. Updated _includes/amazon-affiliate-block.html
- Added
include.block_idparameter support - Implemented character hashing for block_id strings
- Created
product_offsetvariable based on the block_id hash - Modified scoring logic to use two bonuses:
rotation_bonus: Shifts rotation based on product index + offsetoffset_bonus: Adds variable bonus per product based on block_id (modulo 13, divided by 5.0)
2. Updated Layout Files
All layout files now pass unique block_id parameters:
_layouts/default.html:block_id="bottom"_layouts/home.html:block_id="home-grid"_layouts/month.html:block_id="month-1","month-2", etc. (dynamic based on position)_layouts/year.html:block_id="year-1","year-2", etc. (dynamic based on position)_layouts/race-list.html:block_id="list-1","list-2", etc. (dynamic based on position)
3. Created Documentation
AFFILIATE-BLOCK-TESTING.md: Comprehensive guide on the implementation and testing results
Testing Results
Recent Races Page (3 blocks)
- Block 1: Official History (English), Wahoo ELEMNT BOLT v2, Gore Wear Maillot
- Block 2: Official History (English), Garmin Edge 840, Wahoo ELEMNT ROAM
- Block 3: La Historia (Española), Garmin Edge 840, Official History (English)
October Month Page (16 blocks, showing first 5)
- Block 1: Garmin Edge 840, Wahoo ELEMNT BOLT v2, Official History (English)
- Block 2: Garmin Edge 840, La Historia (Española), Paris-Roubaix
- Block 3: Official History (English), La Historia (Española), Wahoo ELEMNT ROAM
- Block 4: Garmin Edge 840, Le Livre Officiel (Francés), Los Años Heroicos
- Block 5: Official History (English), Wahoo ELEMNT BOLT v2, Gore Wear Maillot
Benefits
✅ Each ad banner shows different products
✅ Better user experience with product variety
✅ Maintains relevance through terrain/season/keyword filtering
✅ Simple to implement - just add block_id parameter
✅ Automatic variation through hash-based scoring
Technical Details
The block_id is hashed by summing ASCII-like values of each character (supports 0-9, a-z, hyphen). This hash value creates:
- A
product_offset(0-9) that shifts rotation patterns - An
offset_bonusthat varies by product position, creating significant score changes
The offset bonus calculation: product_offset × forloop.index % 13 ÷ 5.0 creates enough variance to promote different products to top positions across different blocks.