You will learn
Learn how to add Klaviyo Reviews widgets to a mobile app built with Tapcart. These widgets can be added to your Tapcart app using custom blocks:
-
Star rating widget
Product pages only; show a product’s overall star rating -
Product reviews widget
Product pages only; show a summary and list of all reviews for a product, plus buttons to ask a question or leave a review -
Featured reviews carousel widget
Any page; show a selection of featured reviews across several products
Tapcart is only available for stores built with Shopify.
Before you beginBefore you begin
This process is only available to companies who:
- Have already built a mobile app with Tapcart
- Use a Tapcart Enterprise plan
- Have an active Klaviyo Reviews plan
If you haven’t set up Klaviyo Reviews yet, head to our article on getting started with Klaviyo Reviews.
Add Klaviyo Reviews widgets using a custom block in TapcartAdd Klaviyo Reviews widgets using a custom block in Tapcart
Follow these steps to add any reviews widget in Tapcart. You’ll need to repeat these steps (i.e., create a separate custom block) for all 3 widgets.
- Open the Tapcart editor.
- In App Studio, switch from Design Blocks to Custom Blocks.
- Click Launch Blocks Editor to create a new custom block.
- Name the widget something clear, like Klaviyo Star Rating custom block.
- In the JS tab of the block editor, add the following code snippet. Replace PUBLIC_API_KEY with your 6-character Klaviyo site ID.
var script = document.createElement('script'); script.type = 'text/javascript'; script.async = true; script.src = 'https://static.klaviyo.com/onsite/js/PUBLIC_API_KEY/klaviyo.js&module=reviews'; document.head.appendChild(script);
- In the HTML tab of the block editor, paste the snippet for the widget you’d like to add (e.g., the star rating widget). Find the code snippets below:
- Click Save.
- Click Close to exit the editor.
- From the App Studio dropdown, select Product detail.
This step is required for the star rating and product reviews widgets. You can place the featured review widget on any app page. - Drag the saved custom block you just created into your template.
- The editor may not load the widget directly; instead, you’ll see the block name as plain text. This is expected.
- Click Preview your app and navigate to the page where you added your app. Note that the widget appears correctly.
Code snippets
Star rating widgetStar rating widget
<div class="klaviyo-star-rating-widget" data-id="{{product.id}}" data-product-title="{{product.title}}" data-product-type="{{product.type}}"></div>
Product reviews widgetProduct reviews widget
<div id="klaviyo-reviews-all" data-id="{{product.id}}"></div>
Featured reviews carouselFeatured reviews carousel
<div id="klaviyo-featured-reviews-carousel"></div>
Preview app widgetsPreview app widgets
The Klaviyo Reviews widgets won't automatically appear in the Tapcart preview, but will load correctly on your app. This is because the widgets require a real product ID in order to know which reviews to display. To preview the widgets, add a product ID variable in the Variable Preview Values field in the Tapcart editor.
- In the Tapcart App Studio, select Custom to view your custom widgets.
- Click the three dots icon next to one of your review widget blocks and click Launch Editor.
- Click Settings.
- Scroll or search through the JSON to find the id variable within the product object. Note that there are other id variables within other objects; you only need to edit the product ID shown here.
- Replace the sample product ID with the ID for a product in your store that has at least 1 review. To find a product ID, navigate to Content > Products in Klaviyo, then copy an item ID.
- Click Save.
- Repeat these steps for your other review widget blocks.
- If the previews don't appear correctly right away, refresh the editor.
Style app widgets
Any changes made in the main widget editor will apply to both your website and your app. To apply changes to just your app, add custom CSS to the CSS tab of the custom block editor in Tapcart. Learn how to use custom CSS to style Klaviyo Reviews widgets.
Additional resources