Skip to main content

Pagefly Integration

Wendy avatar
Written by Wendy
Updated over a week ago

If you prefer, you can check out this information in video format.

To use the Lantern quizzes in PageFly, ensure you have completed the following:

How to access Lantern - Product Quiz Builder Element

Follow these steps to access Lantern - Product Quiz Builder element in Pagefly

Step 1: On the left side of your Shopify App menu, Open Pagefly Page Builder

Step 2: Go to Extra functions, on the Integrations click Manage

Image showing the PageFly dashboard with the 'Extra Functions' tab selected and the 'Manage' button clicked in the 'Integrations' section.

Step 3: Search Lantern and make sure the status is Active after clicking Activate

Image displaying the Integrations list in PageFly, with 'Lantern' searched and the 'Active' status highlighted after clicking Activate to enable the integration.

You can also activate Lantern element inside the PageFly Page Builder

GIF showing the PageFly Page Builder interface with the 'Lantern' element listed under third-party elements, indicating that it can be activated directly within the builder.

Step 4: Navigate to "Pages" and select "Create Blank Page" or "Create from Template." You also have the option to import and export pages that you've created.

Image displaying the PageFly dashboard with the 'Pages' section selected, highlighting the options to 'Create Blank Page', 'Create from Template', and the 'Import' button.

Step 5: On the PageFly Page Builder, click Add third-party elements on the left menu bar

Image showing the PageFly Page Builder interface with the 'Add third-party elements' option highlighted in the left menu bar.

Step 6: Click on "Lantern" and then drag and drop the Lantern Quiz onto the page you're building

Image displaying the action of dragging and dropping the 'Lantern Quiz' element onto the PageFly page being built.

The Lantern ‑ Product Quiz Builder element comes with 1 variant which is Lantern Quiz.

GIF showing the action of dragging and dropping the 'Lantern - Product Quiz Builder' element in PageFly, indicating that it comes with one variant labeled 'Lantern Quiz'.

Configure Lantern ‑ Product Quiz Builder Element

  • General Tab: Once you’ve added the Lantern element to your page, click it to adjust settings.

Image displaying the 'General' tab settings for the Lantern element in PageFly, where users can adjust various configurations after adding the element to a page.

Styling Tab (Optional): PageFly offers options like margins, borders, and effects. Access them in the “Styling” tab for customization. Refer to this article for more details.

Paste the API Key and select the quiz you want to display from the dropdown menu labeled "Quiz list."

Image displaying the settings panel in PageFly where users can paste the API Key and select the desired quiz from the 'Quiz list' dropdown menu.

NOTE: You can get the Api Key in Lantern Dashboard under Integrations tab

Image showing the Lantern Dashboard's Integrations tab, highlighting where users can obtain their API Key for integration with PageFly.

Click Save and Publish the Page to make it go live

Image displaying the 'Save' and 'Publish' buttons in PageFly, indicating the final steps to make the page with the Lantern quiz live.

Image showing the preview mode in PageFly with a published page displaying the embedded Lantern quiz as it appears live.

Custom code for perfect PageFly integration

In order to achieve the same visual results you get with embedding a Lantern quiz via App Blocks in your Shopify Theme you will need to add the following JavaScript code into the custom code section of PageFly for this section:

<script>
let has_scrolled = false;
let lantern_iframe_height = 0;
let lantern_iframe_height_timestamp = 0;

window.addEventListener("scroll", function() {
has_scrolled = true;
});

(function() {
window.addEventListener("message", function(e) {
if (e.data.action === "resize" && e.data.frameHeight) {
console.log(`received message to resize the iframe by ${e.data.frameHeight}px`);
const iframes = document.querySelectorAll("iframe");
const lantern_iframe = Array.from(iframes)?.find(iframe => iframe.contentWindow === e.source);
if (e.data.frameHeight > lantern_iframe_height || Date.now() - lantern_iframe_height_timestamp > 2000) {
console.log(`resizing iframe to ${e.data.frameHeight}px`);
lantern_iframe_height = e.data.frameHeight;
lantern_iframe_height_timestamp = Date.now();
lantern_iframe.style.height = `${e.data.frameHeight}px`;
}
if (lantern_iframe.dataset.inView && has_scrolled) {
lantern_iframe.scrollIntoView();
setTimeout(() => {
window.scrollBy(0, 1);
}, 25);
}
}
}, false);

const iframe_in_view_observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.dataset.inView = true;
}
});
});

const iframes = document.querySelectorAll("iframe");
iframes?.forEach(iframe => iframe_in_view_observer.observe(iframe));
})();
</script>

If you have any questions or need support in setting this up in PageFly please don't hesitate to contact our support team using the in-app chat toggle or by e-mail at [email protected]

Did this answer your question?