WordPressサイトが訪問者のブラウザーにCookieを設定している可能性があることをご存知ですか?欧州連合のGDPRのようなさまざまな規制では、コンピューターにCookieを設定する前にユーザーの同意を得ることをサイトに義務付けています。
WordPressでは、さまざまなプラグインを使用して簡単にクッキーの同意を設定することができます。私たちは複数のツールをテストし、私たち自身のウェブサイトに実装しましたが、最良の選択肢はWPConsentとCookie Noticeであることがわかりました。
この投稿では、WordPressでCookieポップアップを追加する方法を紹介します。

Cookieポップアップはなぜ必要か?
ブラウザーCookieは、ウェブサイトがユーザーのブラウザーに保存するために送信するデータを含む小さなファイルです。ほとんどのWordPressサイトは、さまざまな目的でCookieを設定しています。
例えば、初期設定では、WordPressは認証目的でCookieを使用し、ログイン中のユーザーのセッション情報を保存します。また、誰かがサイトにコメントを残すとCookieが設定されます。
これらとは別に、WordPressプラグインは、異なる情報を保存したり、リピーターを認識したりするために、独自のCookieを設定することもできます。
WordPressサイトがCookieを使用しているかどうかを確認する方法をご覧ください。
Cookieは非常に便利ですが、ユーザーに関する情報を収集し、サードパーティの広告プラットフォームと共有するために使用されることもあります。
そのため、ヨーロッパをはじめとするいくつかの国では、サイト所有者がクッキーの使用についてユーザーに知らせることが必須となっています。あなたのサイトがこれらの地域のオーディエンスをターゲットにしている場合、Cookie同意の免責事項を表示する必要があります。

それを行う最も簡単な方法は、WordPressのGDPRプラグインを使用することです。WPConsentとCookie Noticeは最も人気のあるクッキー通知プラグインの2つで、他の多くの人気のあるWordPressプラグインと互換性があります。
とはいえ、WordPressでCookie同意ポップアップを簡単に表示する方法を見てみましょう。
方法1:WPConsentでクッキーポップアップを追加する(推奨)
WordPressウェブサイトにクッキーのポップアップを追加する最良の方法は、WPConsentを使用することです。
WPConsentを使えば、ウェブサイトのデザインに合わせたカスタムクッキーの同意ポップアップやバナーを簡単に作成できます。
さらに、警告を表示するだけのほとんどのクッキー通知プラグインとは異なり、WPConsentは、訪問者が同意を与えるまで、すべてのトラッキングスクリプトとクッキーを自動的にブロックすることで、ユーザーのプライバシーを実際に保護します。これは、あなたのサイトがGDPR法令に適切に従うことを保証するのに役立ちます。
プラグインについてさらに詳しく知りたい方は、WPConsentのレビューをご覧ください。
注: WPConsentには無料版もあります。しかし、このチュートリアルでは、より高度な機能を備えたProバージョンを使用します。
始めるには、WPConsentプラグインをインストールして有効化する必要があります。ヘルプが必要な場合は、WordPressプラグインのインストール方法のステップバイステップガイドをご覧ください。
プラグインが有効化されると、簡単なオンボーディングウィザードが起動します。さっそく「Let’s Get Started」ボタンをクリックして、5分でプラグインをセットアップしましょう。

まず、ライセンスキーを「ライセンスキー」フィールドにコピー&ペーストし、「キーを確認」ボタンをクリックしてください。ライセンスキーはWPConsentウェブサイトのアカウントエリアにあります。
ライセンスキーが認証されたら、「Scan Your Website」ボタンをクリックしてください。

WPConsentは次に、クッキーを使用している可能性のある既知のサードパーティスクリプト、コア機能、WordPressプラグインについて、ウェブサイト全体をスキャンします。
スキャンが終了すると、WPConsentはクッキーを設定したサービスの数を通知します。それらを確認するには「OK」ボタンをクリックしてください。

これで、ウェブサイト上でどのサービスがクッキーを使用しているかを確認できます。私たちのテストサイトでは、WordPressのコメントとWPFormsがクッキーを使用していることがわかります。
Auto-Configure Selected(選択したサービスを自動設定する)」ボタンをクリックすると、検出されたサービスの説明、クッキーの持続時間、データポリシーURLなど、すべてのクッキーとプライバシー情報が自動的にインポートされ、設定されます。

クッキーデータが設定されたので、あなたのウェブサイトに表示するクッキーのポップアップやバナーのレイアウトと位置を選択できます。

レイアウトを選択すると、ページをスクロールしてプレビューを見ることができます。
ここから、クッキー・バナーのデザインに満足したら、「保存してセットアップを完了する」をクリックできます。または、「さらにバナースタイルを設定する」を選択して、クッキーポップアップをカスタマイズすることができます。

Cookieポップアップ通知のカスタマイズ
さらにバナースタイルを設定する」をクリックすると、WPConsent ” バナーデザインページに移動します。
ここから、背景色、テキスト色、フォントサイズ、ボタンタイプ、ボタン色など、クッキーポップアップのスタイルを変更できます。
保存」ボタンをクリックして、スタイル設定の変更を保存することを忘れないでください。

次に、「コンテンツ」タブをクリックして、クッキーのポップアップメッセージをカスタマイズできます。また、ページをスクロールして、ボタンテキストを編集し、ボタンの順序を変更し、ロゴやアイコンをアップロードすることもできます。
デザインに満足したら、「保存」ボタンをクリックします。

これで、あなたのWordPressウェブサイトを訪問して、クッキーポップアップがどのように見えるかを実際に見ることができます。

WordPressサイトにクッキーポリシーを追加する
また、ウェブサイトのプライバシーポリシーにクッキーの宣言を追加する必要があります。プライバシーポリシーページをまだ作成していない場合は、WordPressでプライバシーポリシーページを作成する方法のガイドに従ってください。
WPConsentはクッキーポリシーを簡単に作成できます。あなたのウェブサイトを自動的にスキャンしてすべてのアクティブなクッキーを検出し、各クッキーの目的、期間、種類を文書化した詳細なクッキーポリシーを生成します。
クッキーポリシーを設定するには、WordPressの管理エリアからWPConsent ” ダッシュボードに行き、「クッキーポリシー」の隣にある「設定」ボタンをクリックします。

これでWPConsentの「設定」ページが表示されます。ここからページを下にスクロールし、「クッキーポリシー」セクションまで進んでください。
ドロップダウンメニューから、クッキーポリシーに使用するページを選択できます。このチュートリアルでは、プライバシーポリシーページにクッキー宣言を追加します。
また、WPConsentが提供するショートコードをコピーする必要があります。

ページ下部の「変更を保存」ボタンを忘れずにクリックしてください。
次に、プライバシーポリシーページを編集し、クッキー宣言を表示したい場所にショートコードを挿入するだけです。

クッキー宣言を見るには、ページを保存してプレビューする必要があります。これが、私たちのテストウェブサイトでの最初の数段落の見え方です:

方法2: クッキーポップアップにクッキー通知を追加する
Cookie Noticeを使えば、WordPressサイトにクッキーのポップアップを追加することもできます。これは使いやすい無料のプラグインです。ただし、WPConsentほど機能は豊富ではありません。
まず、Cookie Notice & Compliance for GDPR / CCPAプラグインをインストールして有効化する必要があります。詳しくは、WordPressプラグインのインストール方法のステップバイステップガイドをご覧ください。
有効化したプラグインは、追加設定なしで、訪問者に基本的なCookieポップアップをすぐに表示し始めます。初期設定のメッセージはほとんどのサイトに適しています。

通知をカスタマイズしたい場合は、WordPressダッシュボードのCookieメニュー項目にアクセスする必要があります。
ここから、通知設定のセクションまでスクロールダウンするだけです。

このページでは、ポップアップメッセージとボタンのテキストをカスタマイズできます。
プライバシーポリシーページへのリンクを追加することもできます。まだ作成していない場合は、WordPressでプライバシーポリシーページを作成する方法をご覧ください。
その後、プライバシーポリシーのドロップダウンメニューからそのページを選択することができます。

WordPressのCookieプラグインは、訪問者が同意を拒否したり取り消したりする設定も提供します。
そのためには、「同意を拒否する」と「同意を取り消す」のチェックボックスをクリックするだけです。初期設定でほとんどのサイトに対応できます。

通知のデザイン」セクションまでスクロールダウンすると、Cookie同意ポップアップの位置、アニメーション、ボタンのスタイル、および色を選択できます。
ボタンクラスを設定して、ポップアップにカスタムCSSを追加することもできます。

設定が完了したら、最後に「変更を保存」ボタンをクリックして設定を保存します。
これで、あなたのサイトにアクセスして、Cookie同意ポップアップを実際に見ることができます。

ボーナス:MonsterInsightsでGDPRコンプライアンスを向上させる
MonsterInsightsはWordPressサイトに最適な分析ソリューションです。また、GDPRやその他のプライバシー規制へのコンプライアンスを向上させる最も簡単な方法です。
それは、MonsterInsightsがすぐに使えるEU Complianceアドオンを提供しているからです。MonsterInsightsが提供するEUコンプライアンスアドオンは、あなたのアナリティクス設定を自動的に変更し、個人情報保護法の遵守を支援します。

EUコンプライアンスアドオンはプレミアムプランに含まれています。最大の特徴は、Cookie NoticeとCookiebotの両方と自動的に統合されることです。
詳しくはMonsterInsightsのレビューをご覧ください。
最初のステップは、MonsterInsightsプラグインをインストールし、Googleアナリティクスアカウントに接続することです。詳しくは、MonsterInsightsを使ったGoogleアナリティクスのインストール方法をご覧ください。
MonsterInsightsをインストールしてセットアップしたら、EU Complianceアドオンをインストールして有効化する必要があります。
WordPress ダッシュボードのInsights ” Addonsページにナビゲーションしてください。次に、EU Complianceアドオンを見つけて、「インストール」ボタンをクリックします。

アドオンは自動的に有効化されます。
MonsterInsightsの ” 設定 “ページで、”エンゲージメント “タブに切り替えることで確認できます。
EU Complianceセクションを見ると、アドオンがオンになっていることがわかります。

画面の右側にある下矢印をクリックすると、アドオンがサイトに加えた設定変更の詳細なリストを見ることができます。
例えば、GoogleアナリティクスにおけるIPアドレスの自動匿名化、デモグラフィック、インタレストレポートの無効化、UserIDトラッキングの無効化などです。

次に、MonsterInsightsとCookie NoticeやCookieBotのような様々なCookieプラグインとの互換性を見るためにスクロールダウンすることができます。
MonsterInsightsは、サイトにプラグインがインストールされている場合、自動的にGoogleアナリティクスのトラッキングコードを変更します。これにより、Googleアナリティクスでユーザーをトラッキングする前に、同意を得ることができます。

この投稿がWordPressサイトにCookie同意ポップアップを追加するのにお役に立てば幸いです。WordPressでYes/Noオプトインを作成する方法のステップバイステップガイドとWordPressに最適なポップアッププラグインもご覧ください。
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
Ralph
Thank God there are plugins for that. I wish we as a whole internet could get rid of all that cookies, gdpr and other things and replace it with one but only one thing. It is absurd when we visit new website and before we even see content we have to close so many pop-ups.
WPBeginner Support
It may be annoying but the GDPR was set up with good intentions, hopefully there will be better implementations as time goes on.
Admin
Chanel Burth
Thank you for the article. Does this plugin give the option for people to accept or decline?
WPBeginner Support
It does not as that would require it to interact with everything that sets a cookie and have the power to disable it which isn’t something a plugin would have easily.
Admin
Elliot Jolesch
This article was very helpful but I wonder if it’s a little out of date.
The plugin that you recommended, GDPR Cookie Consent Banner, has not been tested for the latest version of WP and apparently hasn’t been updated in 11 months.
Are you planning an update to this article?
WPBeginner Support
For the not tested warning, you would want to first go through our guide below:
https://www.wpbeginner.com/opinion/should-you-install-plugins-not-tested-with-your-wordpress-version/
We will be sure to take a look at this article for a future update.
Admin
Stephanie
Thank you this was really helpful. One thing done on the site in under 5 minutes. Amazing!
WPBeginner Support
Glad our guide was helpful
Admin
Declan Howard
How do I make sure my website does not drop cookies into a visitor’s computer? I do not need to do this.
WPBeginner Support
It would depend on what tools and plugins you are using on your site, you would want to reach out to those to see if they add any cookies or not.
Admin
Deb Smith, Small Details
We can ALWAYS count on WPBeginner to give us solid plugin recommendations. I’ve been a “beginner” for over a decade haha!
WPBeginner Support
Thank you, glad our articles have been helpful
Admin
Farukh Hussain
Hi,
Thanks for sharing this useful post. However, many plugins make site loads slower. Can you please suggest some code to display this notification.
WPBeginner Support
We do not have a beginner friendly method to add this using strictly code at the moment. For your statement about plugins, they are lines of code as well so as long as the plugin is properly coded it should not have a noticeable impact on your site compared to directly coding it. We would recommend taking a look at our article here: https://www.wpbeginner.com/opinion/how-many-wordpress-plugins-should-you-install-on-your-site/
Admin
Aurora
Can you recommend a way to add a cookie consent without the use of a plugin? My site has too many plugins already.
Sarah A
Hi,
Can you recommend a cookie consent for ‘opt in’ that is suitable for the new GDPR law?
Julia
Hi,
I’m trying to set up an e-commerce website and have to comply with EU law regarding the use of cookies. How can I find out which cookies my website is using?
Thanks
Samuel
Hi,
I’m looking for a pop up box that imitates the one on the gucci website as it is a square, do you know of any?
kulbir singh kang
hi me kulbir singh
something problem in my website ,,,,,when i open to this ,,it is automatically redirect on another multi pal site ,,,,when i open second time it is working properly
and if when i clear cache cookies of browser (problem in all browser) ,then i go to ,,,same problem display on system
please visit on my website ,,,and please tell me ,,,, what is solution of this problem
is this problem of cookies or not ,,,,
WPBeginner Support
Your website looks infected with malware. See our guide on how to scan your site for malicious code.
Admin
Maninder Pal Singh
Thank you wpbeginner. I was looking for something exactly like this. Light weight plugin with a simple notification for the cookie policy.
Thanks.
Muhammad Ishfaq
Thanks the post, the plugin works perfectly on all of my websites including link to the policy page.
Eva B
It has a glitch. The link to the policy page goes to an error page. I double-checked my spelling and looked on their support forum. There I saw that others left the same request for a fix. No response from developer. This plugin still works for me, but without the link.
WPBeginner Support
@Eva thank you for notifying us, we have tried to contact plugin author as well. It seems like the plugin author didn’t mean to add this functionality. Currently the plugin is only good for adding a simple notification without a link, which satisfies the requirement for the cookie law in most EU countries. However, there should be a link so that users can read privacy policy.
Admin
Keith Davis
Looks good guys and the developer says it is lightweight.
I think I should be using this.