Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Deploy Widget via Tag Manager

Deploy recommendation widgets using Google Tag Manager for flexible widget management without modifying site code.

Deploy Widget via Google Tag Manager

You can deploy recommendation widgets using Google Tag Manager. This method is useful for adding widgets without modifying your site's codebase.

Prerequisites

  • The ip.js tracking script must already be installed on your site, either directly or via a separate GTM tag that fires before the widget tag.

Steps to Deploy Widget Tag

  1. Create a New Tag: In your GTM workspace, create a new tag.

  2. Configure the Tag:

    • Choose Custom HTML as the tag type.
    • Paste the widget script code into the HTML field. Replace YOUR_DELIVERY_KEY with your actual key.
    <script class="idio-recommendations" type="text/x-mustache" data-api-key="YOUR_DELIVERY_KEY">
       {{#content}}
       <div class="idio-recommendation">
           {{#main_image_url}}
               <a href="{{link_url}}"><img src="{{main_image_url}}?w=150&h=150" class="image" /></a>
           {{/main_image_url}}
           <h3><a href="{{link_url}}">{{title}}</a></h3>
           <p>
               {{abstract}}
               <a href="{{link_url}}">Read more...</a>
           </p>
       </div>
       {{/content}}
    </script>
  3. Configure the Trigger:

    • Set the trigger to fire on the specific pages where you want the widget to appear. You can use a Page View trigger with conditions based on the Page Path.
  4. Save and Publish: Save your tag and publish the GTM container.