Code Injection Guide: How to Add HTML & Scripts to Your Website

By Michael Turner

December 12, 2024 at 04:09 PM

Code Injection Guide

Enhance your website by adding custom HTML and scripts through code injection. This feature allows you to integrate services like live chat, domain validation, and analytics tools.

Important Notes:

  • Code injection is for scripts and HTML only, not for content or styles
  • CSS should be added via the custom CSS editor
  • Checkout pages don't support code injection
  • Scripts may need to be disabled during site editing

Adding Code:

  1. Open the "Code Injection" panel
  2. Add valid HTML or scripts to desired sections
  3. Click Save

Available Injection Points:

Header Section

  • Injected into the tag
  • Appears on all pages

Footer Section

  • Injected before tag
  • Appears on all pages

Lock Page

  • Appears above password field
  • Used for protected pages

Order Confirmation Page

  • Appears after gift card/subscription purchases
  • Supports customer information tags:
    • {orderId}
    • {orderSubtotal}
    • {orderGrandTotal}
    • {customerEmailAddress}

Order Status Page

  • Shows after physical/digital product purchases
  • Supports same tags as confirmation page
  • Use {.if firstPageView} for one-time tracking

Cookie Banner Integration:

  1. Enable cookie banner in settings
  2. Select Accept/Reject options
  3. Add integration code
  4. Save changes

Page-Specific Injection:

  1. Hover over page in Pages panel
  2. Click settings icon
  3. Select Advanced
  4. Add code to page header or blog post sections

Migrate order confirmation code

Migrate order confirmation code

Troubleshooting:

  • Disable scripts in preview mode if editing issues occur
  • Test code in private/incognito window
  • Remove problematic code temporarily during troubleshooting
  • JavaScript must be between
  • CSS should be between <style> tags

For complex customizations, consider hiring a developer or upgrading to premium plans for advanced features.

Related Articles

Previous Articles