Publisher docs · Shopify

    Estimated time: 5–10 minutes

    Install HalalSpark on Shopify

    Shopify does not use plugins for this type of installation. Scripts are added directly through your theme's code editor or the visual customiser.

    Before you start

    Your website must be approved before ads can serve. If you have not added your site yet:

    1. Go to your HalalSpark dashboard
    2. Click Add Website
    3. Submit for review

    Approval usually takes up to 24 hours. You will be notified when complete.

    Auto Ads

    Add one script to your Shopify theme.
    HalalSpark handles placement automatically.

    You only need to add this script once to your theme. Shopify's theme.liquid file loads on every page of your store — so a single script covers your entire site.

    Control ad types, density, and page rules from your dashboard.

    Get your Auto Ads script

    1. Go to your HalalSpark Publisher Dashboard
    2. Click your website
    3. Open the Set Up Ads tab
    4. Select Auto Ads and complete the setup steps
    5. Copy your script from the final screen

    If setup is already complete:

    • Go to your website → Placements tab
    • Click Copy Script next to your Auto Ads configuration
    Example — Auto Ads script
    <script src="https://ads.halalspark.co.uk/get-auto-ads-script?websiteId=YOUR_WEBSITE_ID" async></script>
    YOUR_WEBSITE_ID is unique to your site. Copy the script exactly as shown. Do not edit it.

    Open your theme's code editor

    In your Shopify Admin:

    1. Go to Online Store → Themes
    2. Find the theme marked Current theme — this is your live theme
    3. Click ⋯ → Edit code
    ImportantMake sure you are editing your live theme — the one marked Current theme. Editing a draft or unpublished theme will have no effect on your store.

    Open theme.liquid and paste the script

    In the file list on the left, open Layout → theme.liquid.

    Find the closing </head> tag. Paste your script directly before it.

    theme.liquid
    <head>
      {{ content_for_header }}
    
      <script src="https://ads.halalspark.co.uk/get-auto-ads-script?websiteId=YOUR_WEBSITE_ID" async></script>
    </head>
    ImportantDo not remove the async attribute. Without it, the script can block your page from loading.

    Save the file

    Click Save in the top-right corner of the code editor.

    ImportantShopify does not auto-save. If you close the editor without saving, your changes will be lost.

    Check your installation

    • Open your store in a new tab
    • Ads should appear within a few seconds
    • If nothing appears, add ?test=1 to your URL to preview, or see troubleshooting below

    Adjust settings any time

    You can change your settings at any time from the Placements tab in your dashboard:

    • Ad density — number of ads per page
    • Ad types — inline, banner, header, footer, sidebar
    • Page rules — include or exclude specific URLs

    Changes apply immediately. No code updates required.

    If you update your Shopify theme in future, check that your script is still in theme.liquid. Theme updates can overwrite your changes.
    Need different ad settings on different page types — lighter ads on your homepage, denser on blog posts? Use named profiles. Each profile gets its own script URL (&profile=NAME) that you paste into the relevant Shopify template file. Set them up in your dashboard under Set Up Ads → Auto Ads → Add Profile. Full details in the Auto Ads guide.
    Done. Auto Ads are now active. Impressions are only counted when an ad is at least 50% visible on screen for 1 second.
    Preview mode
    Add ?test=1 to your page URL. Ads show with a TEST label. No impressions are recorded.
    Debug mode
    Add ?debug=true to your page URL. Open your browser console to view logs and placement decisions.

    Manual Ads

    Place ads exactly where you want them.
    Each placement has its own script from your dashboard. Add it to your theme where the ad should appear.

    ImportantManual scripts must be placed in the main content area of your theme — not in the head section.

    Path A — Custom Liquid block

    For Shopify 2.0 themes. No code editing required. Use the visual customiser to place ads on specific pages.

    Get your placement script

    1. Go to your HalalSpark Publisher Dashboard
    2. Click your website
    3. Open the Set Up Ads tab
    4. Select Manual Ads, choose an ad type, and complete the setup
    5. Copy your script from the final screen

    If the placement already exists:

    • Go to your website → Placements tab
    • Click Copy next to the placement you want to install
    Example — banner placement
    <script src="https://ads.halalspark.co.uk/get-ad-script-banner?placement_id=YOUR_PLACEMENT_ID&domain=yourdomain.com&_v=3.0" async></script>
    ImportantThe domain= value must match your registered domain exactly.
    example.com and www.example.com are treated as different values. A mismatch will prevent ads from serving.

    Open the theme customiser

    In your Shopify Admin:

    1. Go to Online Store → Themes
    2. Click Customize on your live theme
    3. Use the dropdown at the top to select the page type where the ad should appear
    You can target specific page types: Home, Product, Collection, Blog post, and others.

    Add a Custom Liquid block

    In the left panel, find the section where you want the ad. Click Add block and select Custom Liquid.

    If you do not see a Custom Liquid option, your theme may not support it. Use Path B instead.

    Paste your script and save

    Paste your placement script into the Custom Liquid block. Click Save in the top-right corner.

    The ad will appear at the position of the block on that page type. This applies to all pages of that type — for example, all product pages or all blog posts.

    Each placement needs its own Custom Liquid block and its own script from your dashboard.

    Path B — Theme file editing

    For any Shopify theme. Requires editing Liquid template files directly. Use this if your theme does not support Custom Liquid blocks.

    Advanced method

    Editing theme files directly is harder to undo. If you are not comfortable editing code, consider using a Custom Liquid block (Path A) or contacting your theme developer.

    Get your placement script

    1. Go to your HalalSpark Publisher Dashboard
    2. Click your website
    3. Open the Set Up Ads tab
    4. Select Manual Ads, choose an ad type, and complete the setup
    5. Copy your script from the final screen

    If the placement already exists:

    • Go to your website → Placements tab
    • Click Copy next to the placement you want to install
    Example — banner placement
    <script src="https://ads.halalspark.co.uk/get-ad-script-banner?placement_id=YOUR_PLACEMENT_ID&domain=yourdomain.com&_v=3.0" async></script>
    ImportantThe domain= value must match your registered domain exactly.
    example.com and www.example.com are treated as different values. A mismatch will prevent ads from serving.

    Identify the right template file

    The file to edit depends on where you want the ad to appear:

    Page typeCommon file location
    Blog postsections/main-article.liquid
    Product pagesections/main-product.liquid
    Collection pagesections/main-collection.liquid
    Regular pagesections/main-page.liquid
    Homepagetemplates/index.liquid or sections/
    File names vary by theme. If you cannot find an exact match, look inside the sections/ folder for a file whose name matches the page type you want.

    Open the file and paste your script

    In your Shopify Admin:

    1. Go to Online Store → Themes → ⋯ → Edit code
    2. Open the relevant file from the file list
    3. Find the position in the template where the ad should appear
    4. Paste your script at that position
    ImportantDo not paste the script inside {% style %} or {% schema %} blocks. It must be in the main template body.

    Save the file

    Click Save. Open the page on your live store to confirm the ad renders correctly.

    Repeat for each position. Each placement needs its own script.
    Done. Manual Ads are now active. Impressions are only counted when an ad is at least 50% visible on screen for 1 second.
    Preview mode
    Add &test=1 to the script URL. The ad renders with a TEST label. No impression is recorded.
    Debug mode
    Add &debug=1 to the script URL. Open your browser console to see the targeting decision for that placement.

    Ads not showing?

    Work through this checklist before raising a support request.

    Script placement

    • Auto Ads script is inside theme.liquid, before </head>
    • Manual Ads scripts are inside your template file in the body, at the exact position where the ad should appear
    • The async attribute is present on the script tag
    • The script URL uses ads.halalspark.co.uk

    Theme & saving

    • You edited the Current theme — not a draft or unpublished theme
    • You clicked Save after editing — Shopify does not auto-save
    • If you recently updated your theme, check that the script is still in theme.liquid — theme updates can overwrite changes

    Domain & approval

    • Your website is approved in your HalalSpark dashboard — the Set Up Ads tab only unlocks after approval
    • The domain= value in your manual placement script matches your registered domain exactly

    Custom Liquid blocks

    • Custom Liquid blocks are only available in Shopify 2.0 themes — if the option is not visible, use Path B (theme file editing)
    • The Custom Liquid block is on the correct page type in the customiser

    Browser & extensions

    • Disable ad blockers and privacy extensions, then reload
    • Test in a private browsing window with all extensions off

    Debug tools

    • Auto Ads: add ?debug=true to your page URL → open browser console
    • Manual Ads: add &debug=1 to the script URL → open browser console
    • DevTools → Network tab → filter for halalspark to check requests and responses