Home
>
Product
>
Template Top
>
詳細ページ

HubSpot CMS: クリック率を高める「画像付きリッチCTA」モジュールの実装

Webサイトのコンバージョンポイントにおいて、ただの「送信」ボタンやテキストリンクではユーザーの興味を十分に惹きつけられないことがあります。特に、ホワイトペーパーのダウンロードやウェビナー申し込みなど、具体的なメリットを提示したい場合は、「視覚的なイメージ(表紙画像)」と「補足テキスト」を組み合わせたリッチなボタンが効果的です。

今回紹介するのは、定期的にキラッと光るエフェクトで注意を引き、マウスオーバーで色がスライドして変化する、高機能なCTAモジュールです。

Demo Video

Detail

このモジュールの目的とメリット

このモジュールの主な目的は、**「ユーザーの視線を集め、クリックへの心理的ハードルを下げること」**です。

主なメリット:

  • 視線誘導: 4秒ごとにボタン上を光が走るアニメーション(シマーエフェクト)があり、動的な要素で自然と視線を集めます。
  • 情報量の多さ: ボタン内に「サムネイル画像」「マイクロコピー(補足)」「メインコピー」を配置できるため、クリックした先に何があるかが直感的に伝わります。
  • 柔軟な運用: HubSpotの「CTAツール」で作成したボタンを埋め込むモードと、このモジュール単体でリンクや画像を自由に設定する「カスタムモード」を切り替えて使用できます。
  • デザイン管理: ブランドカラーに合わせて、通常時とホバー時の色をノーコードで自由に調整可能です。

主なユースケース

このデザインは、ユーザーに強いアクションを促したい以下のような場面に最適です。

  • 資料ダウンロード
    • 資料の表紙画像(サムネイル) + 「3分でわかる!」(補足) + 「資料を無料ダウンロード」(メイン)
  • ウェビナー・イベント申し込み
    • 登壇者の写真 + 「〇月〇日開催」(補足) + 「ウェビナーに申し込む」(メイン)
  • 製品デモ・お問い合わせ
    • 製品ロゴ + 「まずは無料でお試し」(補足) + 「デモをリクエストする」(メイン)
  • 記事の回遊促進
    • 注目記事のアイキャッチ + 「人気記事」(補足) + 「記事の続きをよむ」(メイン)

HubSpot CMSでの使い方

このコードをDesign Managerで実装した後の、ページエディタ(編集画面)での操作方法です。

1. ボタンタイプを選択 (Button Type)

最初に、このボタンをどう運用するかを選択します。

  • Custom (カスタム): モジュール内で画像やテキスト、リンク先を自由に設定するモードです(推奨)。
  • CTA (HubSpot CTA): HubSpotのマーケティング機能「CTA」ツールで作成したボタンを選択して表示します。※この場合、画像やサブテキストのレイアウトはCTAツールの設定に依存しますが、光るエフェクトやボタンスタイルは適用されます。

2. コンテンツの設定(Custom選択時)

「Custom」を選んだ場合、以下の項目が表示されます。

  • Link Field: リンク先URLを設定します。外部リンク、内部ページ、ファイル、メールアドレスなどに対応しています。
  • Thumbnail: ボタンの左側に表示する画像を選択します。資料の表紙やアイコンなどが適しています。
  • Top Text: メインテキストの上に表示される小さな補足テキストです(例:「\ 無料公開中 /」)。
  • Main Text: ボタンのメインとなる文言です。

3. スタイルの調整 (Styles)

「Styles」グループでは、以下のデザインを直感的に変更できます。

  • Base Bg/Text Color: 通常時の背景色と文字色。
  • Hover Bg/Text Color: マウスを乗せた時の背景色と文字色。
  • Border Color / Size: 枠線の色と太さ。
  • Text Size: 上部テキストとメインテキストのフォントサイズ。

モジュールのソースコード

HubSpotのDesign Managerで「新規モジュール」を作成し、以下のコードをそれぞれの箇所に貼り付けてください。

1. fields.json

条件分岐ロジック(visibility)が含まれており、選択したタイプに応じて必要な入力項目だけが表示される使いやすい設計になっています。

[
 {
  "choices": [
   [
    "custom",
    "Custom (Use module fields)"
   ],
   [
    "cta",
    "HubSpot CTA (Select existing)"
   ]
  ],
  "display": "select",
  "display_width": null,
  "id": "86abe95d-12cc-4468-0761-41f0be18f1d6",
  "label": "Button Type",
  "locked": false,
  "multiple": false,
  "name": "button_type",
  "preset": null,
  "reordering_enabled": true,
  "required": false,
  "type": "choice"
 },
 {
  "display_width": null,
  "id": "de5d23b2-d299-d748-e214-c43db3a1526b",
  "label": "Select CTA",
  "locked": false,
  "name": "cta_field",
  "required": false,
  "type": "cta",
  "visibility": {
   "controlling_field_path": "button_type",
   "controlling_value_regex": "cta",
   "operator": "EQUAL"
  }
 },
 {
  "default": {
   "url": {
    "content_id": null,
    "type": "EXTERNAL",
    "href": ""
   },
   "open_in_new_tab": false,
   "no_follow": false
  },
  "display_width": null,
  "id": "4ed2abf9-80f9-3a59-7029-e2ff4b992b2f",
  "label": "Link",
  "locked": false,
  "name": "link_field",
  "required": false,
  "show_advanced_rel_options": false,
  "supported_types": [
   "EXTERNAL",
   "CONTENT",
   "FILE",
   "EMAIL_ADDRESS",
   "BLOG",
   "CALL_TO_ACTION",
   "PHONE_NUMBER",
   "WHATSAPP_NUMBER",
   "PAYMENT"
  ],
  "type": "link",
  "visibility": {
   "controlling_field_path": "button_type",
   "controlling_value_regex": "custom",
   "operator": "EQUAL"
  }
 },
 {
  "default": {
   "size_type": "auto",
   "src": "",
   "alt": null,
   "loading": "lazy"
  },
  "display_width": null,
  "id": "5fb752e9-691e-7b11-a612-94cac8189962",
  "label": "Thumbnail Image",
  "locked": false,
  "name": "thumbnail",
  "required": false,
  "resizable": true,
  "responsive": true,
  "show_loading": false,
  "type": "image",
  "visibility": {
   "controlling_field_path": "button_type",
   "controlling_value_regex": "custom",
   "operator": "EQUAL"
  }
 },
 {
  "allow_new_line": false,
  "display_width": null,
  "id": "0726cb7f-8436-4243-dcec-36ba8bcfb6b1",
  "label": "Top Text (Microcopy)",
  "locked": false,
  "name": "top_text",
  "required": false,
  "type": "text",
  "visibility": {
   "controlling_field_path": "button_type",
   "controlling_value_regex": "custom",
   "operator": "EQUAL"
  }
 },
 {
  "allow_new_line": false,
  "display_width": null,
  "id": "85113087-5591-64c7-c052-2d9720c1ab49",
  "label": "Main Button Text",
  "locked": false,
  "name": "main_text",
  "required": false,
  "type": "text",
  "visibility": {
   "controlling_field_path": "button_type",
   "controlling_value_regex": "custom",
   "operator": "EQUAL"
  }
 },
 {
  "children": [
   {
    "default": {
     "color": null,
     "opacity": null
    },
    "display_width": null,
    "id": "a757c310-1dc8-9f7f-5f73-20dc89173b3e",
    "label": "Base Background Color",
    "locked": false,
    "name": "base_bg_color",
    "required": false,
    "type": "color"
   },
   {
    "default": {
     "color": null,
     "opacity": null
    },
    "display_width": null,
    "id": "44209241-2b72-bb28-b166-ef57a7222a8e",
    "label": "Hover Background Color",
    "locked": false,
    "name": "hover_bg_color",
    "required": false,
    "type": "color"
   },
   {
    "default": {
     "color": null,
     "opacity": null
    },
    "display_width": null,
    "id": "d4f266ca-e938-b1b0-1d3d-4c0a027fe887",
    "label": "Base Text Color",
    "locked": false,
    "name": "base_text_color",
    "required": false,
    "type": "color"
   },
   {
    "default": {
     "color": null,
     "opacity": null
    },
    "display_width": null,
    "id": "64278894-20a7-cf1e-52c9-966217d6d4fb",
    "label": "Hover Text Color",
    "locked": false,
    "name": "hover_text_color",
    "required": false,
    "type": "color"
   },
   {
    "default": {
     "color": null,
     "opacity": null
    },
    "display_width": null,
    "id": "5c01e696-9336-1fcf-e5e4-1987e32d44f4",
    "label": "Border Color",
    "locked": false,
    "name": "border_color",
    "required": false,
    "type": "color"
   },
   {
    "display": "text",
    "display_width": null,
    "id": "a3f5c61a-7ed6-4e17-386b-5550214aca9d",
    "label": "Border Size (px)",
    "locked": false,
    "name": "border_size",
    "required": false,
    "step": 1,
    "type": "number"
   },
   {
    "display": "text",
    "display_width": null,
    "id": "6fb4ebf9-4b2d-c15b-0177-0a8594cacbd1",
    "label": "Top Text Size (px)",
    "locked": false,
    "name": "top_text_size",
    "required": false,
    "step": 1,
    "type": "number"
   },
   {
    "display": "text",
    "display_width": null,
    "id": "81d85724-0b11-31dd-c5e6-937e2270b8c3",
    "label": "Main Text Size (px)",
    "locked": false,
    "name": "main_text_size",
    "required": false,
    "step": 1,
    "type": "number"
   }
  ],
  "default": {
   "base_bg_color": {
    "color": null,
    "opacity": null
   },
   "hover_bg_color": {
    "color": null,
    "opacity": null
   },
   "base_text_color": {
    "color": null,
    "opacity": null
   },
   "hover_text_color": {
    "color": null,
    "opacity": null
   },
   "border_color": {
    "color": null,
    "opacity": null
   }
  },
  "display_width": null,
  "expanded": false,
  "group_occurrence_meta": null,
  "id": "cf5f24f0-39f9-9be6-2158-e2fb915743ad",
  "label": "Styles",
  "locked": false,
  "name": "styles",
  "required": false,
  "tab": "CONTENT",
  "type": "group"
 }
]

Source Code

HTML
<div id="anime-cta-{{ module.id }}" class="anime-cta-wrapper">

  {# --- パターンA: HubSpot CTAを利用する場合 --- #}
  {% if module.button_type == 'cta' %}
  
    {# CTAタグにクラスを注入してデザインを適用 #}
    {% cta guid="{{ module.cta_field }}" extra_classes="anime-cta-button cta-mode" %}
    
  {# --- パターンB: カスタムデザインを利用する場合 --- #}
  {% else %}
  
    {% set href = module.link_field.url.href %}
    {% if module.link_field.url.type is equalto "EMAIL_ADDRESS" %}
      {% set href = "mailto:" + href %}
    {% endif %}
    
    <a href="{{ href }}" 
       class="anime-cta-button custom-mode"
       {% if module.link_field.open_in_new_tab %}target="_blank"{% endif %}
       {% if module.link_field.no_follow %}rel="nofollow"{% endif %}>
       
       {# 画像 #}
       {% if module.thumbnail.src %}
         <div class="anime-cta-button__img-wrapper">
           <img src="{{ module.thumbnail.src }}" alt="{{ module.thumbnail.alt }}" width="{{ module.thumbnail.width }}" height="{{ module.thumbnail.height }}">
         </div>
       {% endif %}

       {# テキスト #}
       <div class="anime-cta-button__content">
         {% if module.top_text %}
           <p class="anime-cta-button__subtext">{{ module.top_text }}</p>
         {% endif %}
         {% if module.main_text %}
           <span class="anime-cta-button__maintext">{{ module.main_text }}</span>
         {% endif %}
       </div>

       {# 矢印 #}
       <span class="anime-cta-button__arrow"></span>
       
       {# キラッと光るエフェクト (CSSで制御) #}
       <span class="anime-cta-button__shine"></span>
    </a>
    
  {% endif %}

</div>

{% require_css %}
<style>
  #anime-cta-{{ module.id }} {
    --base-bg: {{ module.styles.base_bg_color.css || '#fff' }};
    --hover-bg: {{ module.styles.hover_bg_color.css || '#003386' }};
    --base-text: {{ module.styles.base_text_color.css || '#003386' }};
    --hover-text: {{ module.styles.hover_text_color.css || '#fff' }};
    --border-color: {{ module.styles.border_color.css || '#fff' }};
    --border-size: {{ module.styles.border_size || 1 }}px;
    --sub-font-size: {{ module.styles.top_text_size || 14 }}px;
    --main-font-size: {{ module.styles.main_text_size || 18 }}px;
  }
</style>
{% end_require_css %}

CSS
/* コンテナ */
.anime-cta-wrapper {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  font-family: sans-serif;
}

/* ボタン共通スタイル (カスタムaタグ と HubSpot CTAボタンの両方に適用) */
.anime-cta-button,
.anime-cta-wrapper .cta_button {
  position: relative;
  display: flex !important; /* CTAのデフォルトstyleを上書き */
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  width: 100%;
  box-sizing: border-box;
  
  background-color: var(--base-bg);
  border: var(--border-size) solid var(--border-color);
  border-radius: 8px;
  text-decoration: none;
  color: var(--base-text);
  
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  transition: color 0.3s ease, border-color 0.3s ease;
  z-index: 1;
  
  /* フォント設定 */
  font-weight: bold;
  line-height: 1.4;
}

/* ホバー時の背景スライド (Before疑似要素) */
.anime-cta-button::before,
.anime-cta-wrapper .cta_button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -130%;
  width: 140%;
  height: 100%;
  background-color: var(--hover-bg);
  transform: skewX(-25deg);
  transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: -1;
}

/* ホバー時の挙動 */
.anime-cta-button:hover,
.anime-cta-wrapper .cta_button:hover {
  color: var(--hover-text);
  border-color: var(--hover-bg);
}

.anime-cta-button:hover::before,
.anime-cta-wrapper .cta_button:hover::before {
  left: -20%;
}

/* --- 内部コンテンツ (カスタムモード用) --- */
.anime-cta-button__img-wrapper {
  flex-shrink: 0;
  width: 100px;
  z-index: 2;
  display: flex; /* 画像の縦位置調整用 */
  align-items: center;
}
.anime-cta-button__img-wrapper img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain; /* 画像の比率を保って収める */
}

.anime-cta-button__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  z-index: 2;
  line-height: 1.2;
}

.anime-cta-button__subtext {
  font-size: var(--sub-font-size);
  margin: 0 0 4px 0;
  display: block; /* flexからblockに変更し、gapを無効化 */
}

.anime-cta-button__maintext {
  font-size: var(--main-font-size);
}

.anime-cta-button__arrow {
  display: block;
  width: 10px;
  height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  margin-right: 5px;
  transition: border-color 0.3s;
  z-index: 2;
}

/* --- 光るアニメーション (Shine) --- */
/* カスタムモード用 */
.anime-cta-button__shine {
  position: absolute;
  top: 0;
  left: -150%;
  width: 50%;
  height: 100%;
  background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.6) 50%, rgba(255,255,255,0) 100%);
  transform: skewX(-25deg);
  z-index: 0;
  pointer-events: none;
  animation: shine-effect 4s infinite linear;
}

/* CTAモード用 (After疑似要素を利用して光らせる) */
.cta-mode::after {
  content: '';
  position: absolute;
  top: 0;
  left: -150%;
  width: 50%;
  height: 100%;
  background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.6) 50%, rgba(255,255,255,0) 100%);
  transform: skewX(-25deg);
  z-index: 0;
  pointer-events: none;
  animation: shine-effect 4s infinite linear;
}

@keyframes shine-effect {
  0% { left: -150%; opacity: 0; }
  10% { opacity: 1; }
  20% { left: 150%; opacity: 0; }
  100% { left: 150%; opacity: 0; }
}

/* モバイル対応 */
@media (max-width: 600px) {
  .anime-cta-button, 
  .anime-cta-wrapper .cta_button {
    padding: 1rem;
    gap: 0.5rem;
  }
  .anime-cta-button__img-wrapper {
    width: 60px;
  }
}

Javascript

FAQ

「Custom」モードと「HubSpot CTA」モード、どちらを使えばよいですか?

デザインの再現性を重視するなら「Custom」、計測機能を重視するなら「HubSpot CTA」をおすすめします。 Custom(カスタム): このモジュールの最大の特徴である「サムネイル画像+補足テキスト+メインテキスト」のレイアウトを、入力フィールドだけで簡単に再現できます。特定の資料DLやイベント申し込みなど、視覚情報を強く押し出したい場合に最適です。 HubSpot CTA: HubSpot標準の「CTAツール」で作成したボタンを呼び出します。CTAツールの「A/Bテスト」や「スマートコンテンツ(出し分け)」機能を使いたい場合に便利ですが、画像やテキストの配置はCTAツール側の設定に依存するため、このモジュール本来の「リッチなレイアウト」が完全には再現されない場合があります(キラッと光るエフェクトや配色は適用されます)。

アニメーションの間隔(4秒)や速度を変更することはできますか?

速度の変更には、CSS(スタイルシート)の修正が必要です。 色やフォントサイズはページ編集画面(ノーコード)で自由に変更できますが、光るアニメーションの間隔はコード内で定義されています。変更したい場合は、モジュール内の CSS セクションにある以下の数値を調整してください。 CSS /* 4s の部分を好きな秒数(例: 2s や 6s)に変更してください */ animation: shine-effect 4s infinite linear; 数値を小さくすると頻繁に光り、大きくすると間隔が長くなります。

スマートフォンでの表示は対応していますか?また、画像の推奨サイズはありますか?

はい、完全レスポンシブ対応です。画像は正方形や縦長すぎないものが適しています。 スマートフォン(幅600px以下)では、ボタン内の余白や画像のサイズが自動的に縮小され、読みやすさを保ったまま表示されるよう設計されています。 サムネイル画像については、CSSで object-fit: contain(枠内に収める設定)が効いているためどのような比率でも崩れませんが、正方形(1:1) または 少し横長(4:3) の画像を使用すると、テキストとのバランスが最も美しくなります。