Like Dynamic Text Replacement for text, this script changes the background image of a page section based on a URL parameter. You can match the hero image to the ad or email a visitor clicked, without building a separate page for each.
See the demo page built in Unbounce.
This is community code, not an official Unbounce feature. Unbounce Support can't troubleshoot custom code. Test it on a published page before relying on it, and work with a developer if you aren't comfortable editing HTML, JavaScript, and CSS.
Add the background swap to your page
- Copy the script from this GitHub gist and add it to the JavaScripts section with placement set to Before Body End Tag.
- On line 7 of the script, replace
lp-pom-block-8with the ID of your page section. - Host your background images outside Unbounce, for example on Dropbox or Imgur. Images uploaded to Unbounce can't be used, because their URLs can change and the script needs a stable URL to add to the page URL.
- Build your page URLs. Add the image URL to the end of the page URL as the
backgroundparameter, for examplewww.yourdomain.com/landing-1/?background=IMAGE-URL.
To get an image's URL, right-click the image and select Copy image address. Only use images you own the rights to or that are in the public domain. Animated GIFs also work.
Test the change
Run an A/B test with a small share of traffic to confirm the change doesn't lower your conversion rate.