Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/amirrezashf/woocommerce-google-entry-reward/archive/refs/heads/main.zipShow a configurable product-search prompt or coupon reward based on a recent Google referrer signal.
Features
- Product-page reward box for WooCommerce
- Two states: search guidance or coupon reward
- Signed, product-bound state cookie
- Configurable coupon code, label, search suffix, and signal lifetime
- Google search button with the product search phrase prefilled
- Copy-to-clipboard actions
- Lightweight aggregate and per-product analytics
- Visitor/event deduplication to reduce repeated refresh/click inflation
- Admin settings and statistics under WooCommerce
- Legacy global/per-product statistics fallback from older
_fa_sgb_*data - Full-page cache bypass while the personalized feature is active
- No custom database table
Important Security Model
Google detection is based on the browser Referer header. This is a useful marketing signal, but it is not authentication and is not strong anti-fraud proof. A technically capable client can forge a referrer.
The signed cookie prevents a visitor from modifying an already-issued state cookie without detection, but it cannot prove that the original Google referrer was genuine.
Do not use this plugin to protect high-value, confidential, or authorization-sensitive benefits.
Requirements
- WordPress 6.0+
- PHP 7.4+
- WooCommerce
Installation
- Upload
WooCommerce-Google-Entry-Rewardto/wp-content/plugins/. - Activate WooCommerce Google Entry Reward.
- Open WooCommerce → Google Entry Reward.
- Enter a valid WooCommerce coupon code, configure the search suffix, and enable the feature.
How It Works
When a customer lands directly on a product page with a Google referrer, the plugin issues a signed, short-lived cookie bound to that product and landing path.
For the lifetime configured in the admin screen, that same product can display the configured coupon code. Other products do not inherit the state.
Visitors without a valid Google state see a ready-to-copy search phrase and a Google search button instead.
Full Page Cache
The box is personalized. While the feature is active and a coupon code is configured, product pages define DONOTCACHEPAGE to reduce the risk of a cached reward state being shown to the wrong visitor.
Most WordPress page-cache plugins respect this constant, but cache/CDN behavior should still be verified on the target infrastructure.
Analytics
Tracked events:
- Google-mode impressions
- Search-guidance impressions
- Search phrase copies
- Coupon code copies
- Google search button clicks
Analytics are intentionally lightweight and approximate. Public browser events can never be made fully tamper-proof without a stronger identity/session model.
Data Storage
Options:
wcger_settingswcger_stats
Per-product counters use _wcger_* product meta keys.
The plugin can read older fa_sgb_global_stats and _fa_sgb_* counters as a backward-compatibility fallback.
Cookies:
wcger_state— short-lived signed Google-entry statewcger_vid— random visitor identifier used for event deduplication
Privacy
The plugin does not intentionally store IP addresses, search-engine query strings, or Google account information.
It stores a random browser identifier cookie for analytics deduplication and aggregate counters in WordPress.
Compatibility
The display hook uses the classic WooCommerce single-product template action woocommerce_after_single_product_summary.
Themes or block-based product templates that do not execute this hook may require a dedicated integration.
License
GPL-3.0
Author
Amirreza Shayesteh Far
https://github.com/amirrezashf
پاداش ورود از گوگل برای ووکامرس
این افزونه بر اساس سیگنال Referrer گوگل، در صفحه محصول یکی از دو حالت «راهنمای جستجو» یا «نمایش کد تخفیف» را نمایش میدهد.
قابلیتها
- دو حالت نمایش برای صفحه محصول
- Cookie امضاشده و وابسته به همان محصول
- تنظیم کد تخفیف، عنوان، عبارت جستجو و مدت اعتبار از پنل مدیریت
- دکمه جستجوی مستقیم در گوگل با عبارت آماده
- کپی عبارت و کد تخفیف
- آمار کلی و آمار هر محصول
- Deduplication برای کاهش بادکردن آمار با Refresh و کلیک تکراری
- صفحه تنظیمات و آمار زیر منوی WooCommerce
- خواندن آمار قدیمی
_fa_sgb_*برای سازگاری عقبرو - جلوگیری از Full Page Cache روی صفحه محصول هنگام فعال بودن قابلیت
- بدون Custom Table
مدل امنیتی
تشخیص ورود از گوگل بر اساس Header مرورگر Referer است. این سیگنال برای کاربرد بازاریابی مناسب است اما احراز هویت یا ضدتقلب قطعی نیست و یک Client فنی میتواند Referrer را جعل کند.
Cookie امضاشده جلوی دستکاری State صادرشده را میگیرد، اما واقعی بودن Referrer اولیه را اثبات نمیکند.
برای مزایای مالی با ارزش بالا یا دسترسیهای حساس نباید به این مکانیزم بهتنهایی تکیه کرد.
نیازمندیها
- WordPress 6.0+
- PHP 7.4+
- WooCommerce
نصب
- پوشه افزونه را در
/wp-content/plugins/قرار دهید. - افزونه WooCommerce Google Entry Reward را فعال کنید.
- وارد WooCommerce → Google Entry Reward شوید.
- یک Coupon معتبر ووکامرس وارد کرده، عبارت جستجو را تنظیم و قابلیت را فعال کنید.
نحوه عملکرد
اگر کاربر مستقیماً وارد صفحه محصول شود و Referrer گوگل باشد، یک Cookie کوتاهمدت و امضاشده ساخته میشود که به همان Product و مسیر Landing وابسته است.
تا پایان مدت اعتبار تنظیمشده، فقط همان محصول میتواند کد تخفیف را نمایش دهد. سایر محصولات این State را به ارث نمیبرند.
کاربری که State معتبر ندارد، عبارت جستجوی آماده و دکمه رفتن به گوگل را میبیند.
Cache
این خروجی Personalized است. برای کاهش ریسک نمایش اشتباه کد تخفیف از Cache به کاربران دیگر، هنگام فعال بودن قابلیت روی صفحه محصول DONOTCACHEPAGE تعریف میشود.
رفتار Cache/CDN زیرساخت مقصد باید پس از نصب واقعی نیز تست شود.
آمار
رویدادهای ثبتشده:
- نمایش حالت ورودی گوگل
- نمایش حالت راهنمای جستجو
- کپی عبارت جستجو
- کپی کد تخفیف
- کلیک دکمه جستجو در گوگل
این آمار سبک و تقریبی است و Event عمومی مرورگر بدون Identity قوی هرگز کاملاً ضدتقلب نمیشود.
ذخیرهسازی
Options:
wcger_settingswcger_stats
Counterهای محصول با Meta Keyهای _wcger_* ذخیره میشوند.
برای سازگاری با نسخه قدیمی، fa_sgb_global_stats و _fa_sgb_* نیز در صورت وجود خوانده میشوند.
Cookies:
wcger_statewcger_vid
حریم خصوصی
افزونه عمداً IP، Query جستجوی گوگل یا اطلاعات حساب گوگل را ذخیره نمیکند.
فقط یک شناسه Random مرورگر برای Deduplication آمار و Counterهای Aggregate ذخیره میشود.
مجوز
GPL-3.0
نویسنده
Amirreza Shayesteh Far
https://github.com/amirrezashf