HTML editor
To edit HTML code, add an HTML element, or a pop-up or section from the Other tab.
HTML tab
Use this tab to create your own elements or add third-party widgets to your page.
To add counters and other widgets to all your site's pages, go to Settings → Analytics or Settings → Code Injection.
You should avoid writing any JavaScript code in <script> tags; use the JavaScript tab instead.
Pay special attention to the structure: an unclosed tag can ruin your site's content placed under the HTML section.
Visibility on devices
You can manage visibility of any content on different types of devices using the attributes:
[data-hidden="desktop"] — to hide content from desktop computers and show only on mobile devices;
[data-hidden="mobile"] — to hide content from mobile devices and show it only on desktop computers;
[data-hidden="all"] — to hide content from all types of devices.
<div class="text" data-hidden="mobile">
Hidden on Mobile
</div>
<div class="text" data-hidden="desktop">
Hidden on Desktop
</div>
Links
You can open pop-ups or the cart using anchor links:
To follow an anchor link or element ID, use a link that looks like:
<a href="#about">Go to section "About"</a>
Use the same notation to open a pop-up by specifying the pop-up ID as an anchor link:
<a href="#form">Show pop-up with form</a>
To open your cart, use the #cart anchor link:
<a href="#cart">Open cart</a>
You can change the behavior of links using the following attributes:
[data-goal="GOAL_NAME"] — it is the name of a goal that will be sent to your analytics service;
[data-action="ACTION_NAME"] — it specifies the type of an action that happens on following the link. This attribute triggers the goal set up in your analytics service. If the attribute isn't specified, then the link value is used.
ACTION_NAME | Goal | Additional attribute | Description |
---|---|---|---|
link by default | link_open | href="URL" — Link URL target="_blank" — Open in a new tab | Open a link / Open a pop-up / Open the cart / Follow an anchor |
cart | add_to_cart | data-product-image="/img/2000018200_600.jpg" — Path to a product image data-product-name="Product name" — Product name data-product-price="1000" — Price for a product unit data-product-count="1" — Quantity of products to be added | Add to the cart |
file | file_load | href="URL" — Path to a file download — Force downloading files that can be opened in the browser (PDF files, images) | Download a file |
modal | modal_open form_open done_open product_show quiz_start | data-modal-id="MODAL_ID" – ID of a pop-up to be opened | Open a pop-up |
close | modal_close | – | Close a pop-up (only for pop-ups) |
none | – | – | Don't handle |
Example of adding to the cart:
<a
data-action="cart"
data-product-image="/img/9512942_1150.webp"
data-product-name="Black Hoodie"
data-product-price="15990"
>
Add product to cart
</a>
Example of opening a pop-up:
<a
data-action="modal"
data-modal-id="form567"
>
Show pop-up
</a>
Example of triggering a goal:
<a
data-action="none"
data-goal="my_custom_goal"
href="#anchor"
>
Go to anchor and run the goal "my_custom_goal"
</a>
Opening images in a pop-up
To open images as the lightbox in a pop-up, use the [data-lightbox="IMAGE_URL"] attribute. Specify the alt attribute to describe images.
By default all images with the data-lightbox attribute are grouped into the carousel. If you want to restrict the search area of such images, use the .lightbox-container class.
Example of using these attributes:
<div class="lightbox-container">
<img
alt="Image #1"
src="/img/2000018199_600.jpg"
data-lightbox="/img/2000018199_1920.jpg"
>
<img
alt="Image #2"
src="/img/2000018200_600.jpg"
data-lightbox="/img/2000018200_1920.jpg"
>
</div>
Lazy loading of images
You can set up the lazy loading of images. Lazy loading means that images start to load only when they enter the viewport.
Use the following attributes:
[data-lazy-bg="IMAGE_URL"] — to add to an element the inline background-image style when an image enters the browser's viewport
<div data-lazy-bg="/img/2000018199_%optimalWidth%.jpg"></div>
[data-lazy-src="IMAGE_URL"] — to add to an element the src attribute when an image enters the browser's viewport
<img width="100%" data-lazy-src="/img/2000018199_%optimalWidth%.jpg">
[data-inline-bg="IMAGE_URL"] — to add to an element the inline background-image style when the page starts loading
<div data-inline-bg="/img/2000018199_%optimalWidth%.jpg"></div>
[data-inline-src="IMAGE_URL"] — to add to an element the src attribute when the page starts loading
<img width="100%" data-lazy-src="/img/2000018199_%optimalWidth%.jpg">
Use the %optimalWidth% variable in the file path to load an optimal width version of the image.
Learn more about the path formats in the Files tab.
NOTE:
For Lazy loading to work properly, the width and height of each image should be explicitly specified in the CSS styles.
For Lazy loading to work properly, the width and height of each image should be explicitly specified in the CSS styles.