=== Emailcampaigns.eu for WooCommerce ===
Contributors: emailcampaigns
Tags: email marketing, email, ecommerce, newsletter, automation
Requires at least: 6.4
Tested up to: 7.0
Requires PHP: 8.1
Stable tag: 1.1.10
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
WC requires at least: 8.0
WC tested up to: 10.7

Connect WooCommerce with Emailcampaigns.eu to sync contacts and track orders, carts and website activity.

== Description ==

Connect your WooCommerce store with Emailcampaigns.eu and use customer, order and shopping activity data for your email marketing.

The official Emailcampaigns.eu plugin automatically synchronizes WooCommerce contacts with your Emailcampaigns.eu account. It can also track completed orders, cart activity and website visits, helping you create more relevant segments, campaigns and automations without repeated manual exports.

= Why use Emailcampaigns.eu for WooCommerce? =

* **Save time with automatic synchronization** – keep customer and subscriber data up to date without repeated CSV imports.
* **Use ecommerce data in your email marketing** – work with registrations, orders, newsletter subscriptions and selected shopping activity.
* **Understand customer behavior** – track carts, completed orders and website visits when the relevant tracking options are enabled.
* **Collect newsletter consent at checkout** – add a configurable opt-in checkbox to classic and block-based checkout.
* **Import existing data** – run bulk synchronization for existing WooCommerce users and orders.
* **Control individual features** – enable only the synchronization and tracking options you need.
* **Use modern WooCommerce features** – compatible with High-Performance Order Storage and Cart and Checkout Blocks.
* **Protect stored credentials** – the API hash is encrypted in the WordPress database using AES-256-CBC with WordPress authentication salts.

= Key features =

* **Contact synchronization** – automatic import into four contact groups: Orders, Registrations, Newsletter Subscription and Do Not Send Newsletters.
* **Cart tracking** – records products added to the cart, removed from the cart, as well as changes in product quantities.
* **Order tracking** – records completed order data on the thank-you page with duplicate protection.
* **Website activity tracking** – records page visits and identifies logged-in users.
* **Newsletter checkbox** – configurable opt-in checkbox for classic checkout and WooCommerce Cart and Checkout Blocks.
* **Cookie consent integration** – supports Complianz, CookieBot, CookieYes and custom solutions.
* **Bulk synchronization** – imports existing WooCommerce users and orders in the background through Action Scheduler.
* **Log viewer** – displays synchronization and diagnostic logs directly in the plugin settings.
* **Privacy tools** – integrates with WordPress Privacy Tools for personal data export and erasure.
* **API hash encryption** – protects stored credentials using AES-256-CBC with WordPress authentication salts.
* **HPOS compatibility** – supports WooCommerce High-Performance Order Storage.

= Requirements =

* WordPress 6.4 or later
* WooCommerce 8.0 or later
* PHP 8.1 or later
* An active [Emailcampaigns.eu](https://www.emailcampaigns.eu/) or [Emailkampane.cz](https://www.emailkampane.cz/) account

== Installation ==

= Before you start =

Make sure you have:

* Administrator access to WordPress
* An active WooCommerce installation
* An active Emailcampaigns.eu account
* The account email address and API hash from Emailcampaigns.eu

= Install and activate the plugin =

1. In WordPress administration, go to **Plugins → Add New Plugin**.
2. Install Emailcampaigns.eu from the WordPress Plugin Directory or upload the ZIP package manually.
3. Activate the plugin.
4. Go to **WooCommerce → Settings → Emailcampaigns.eu**.

= Connect your account =

1. Enter the email address used for your Emailcampaigns.eu account.
2. Enter the API hash copied from your Emailcampaigns.eu account.
3. Click **Get Tracking Key**.
4. Save the changes.
5. Click **Verify Connection**.

The tracking key is required for cart, order and website activity tracking.

= Configure the plugin =

1. Open the contact groups section and create the four default groups in Emailcampaigns.eu.
2. Choose whether to synchronize registered users, contacts from orders and contact attributes.
3. Run bulk synchronization if you want to import existing users and orders.
4. Enable cart, order or website activity tracking according to your needs.
5. Configure the supported cookie consent integration before enabling frontend tracking.
6. Optionally enable and customize the newsletter opt-in checkbox at checkout.
7. Save the changes.

Frontend tracking options are disabled by default and must be enabled by the site administrator.

For a detailed setup guide, visit:
https://podpora.emailkampane.cz/cs/podpora/blog/woocommerce-integrace-emailkampane-cz/

== Frequently Asked Questions ==

= Is an Emailcampaigns.eu account required? =

Yes. An active account is required to connect the WooCommerce store.

= Where can I find the API hash? =

Log in to Emailcampaigns.eu and open the API settings. Copy the API hash and enter it with your account email address in **WooCommerce → Settings → Emailcampaigns.eu**.

= What is the tracking key used for? =

The tracking key connects website, cart and order activity with Emailcampaigns.eu. Generate it from the plugin settings after entering valid account credentials.

= Can I synchronize existing users and orders? =

Yes. Use bulk synchronization in the plugin settings. It runs in the background through Action Scheduler, provides progress information, and can be cancelled.

= Which contact groups does the plugin create? =

The plugin creates four groups: Orders, Registrations, Newsletter Subscription and Do Not Send Newsletters.

= Is the plugin compatible with HPOS and block checkout? =

Yes. It supports WooCommerce High-Performance Order Storage and WooCommerce Cart and Checkout Blocks.

= Which cookie consent solutions are supported? =

The plugin supports Complianz, CookieBot, CookieYes and custom consent implementations.

= Can I customize the newsletter checkbox? =

Yes. You can configure its text and default state. To override the template, copy:

`templates/checkout-optin-checkbox.php`

to:

`your-theme/emailkampane/checkout-optin-checkbox.php`

= How does the plugin support privacy requests? =

It integrates with WordPress Privacy Tools for personal data export and erasure. The administrator can also configure whether contacts without newsletter consent should be synchronized.

= Where can I view plugin logs? =

Open the built-in log viewer in the Emailcampaigns.eu plugin settings.

== External services ==

This plugin connects to the Emailcampaigns.eu and Emailkampane.cz email marketing platform, which is operated by Commerce Media s.r.o. External communication is essential to the plugin's purpose and starts only after the site administrator enters valid account credentials or enables relevant tracking features.

**Endpoints contacted:**

* `https://api.emailkampane.cz/` — JSON REST API used for contact synchronization, contact group management, attribute management, order metadata processing and GDPR data export or erasure. Authentication uses a JWT token obtained from the `/get_session` endpoint with the administrator's account email address and API hash.
* `https://tr-web.emailkampane.cz/tracking-code` — used after credentials are saved or when the administrator manually refreshes the tracking key. The plugin sends the site name and URL.
* `https://tr-fe.emailkampane.cz/v1/app.min.js` and `https://tr-fe.emailkampane.cz/v1/app-starter.min.js` — frontend tracking scripts loaded when a tracking key is configured and the relevant tracking settings are enabled. Loading respects the configured cookie consent integration.

**Data that may be sent:**

* Contact synchronization: email address, first name, last name, city, phone number, company, country, postal code and newsletter consent status.
* Order tracking: order ID, total, currency, products and customer email address after order completion.
* Cart tracking: products added, removed or updated in the cart.
* Page visit tracking: page URL and referrer.
* Tracking key request: site name and site URL.

**Service provider:**

* Emailcampaigns.eu and Emailkampane.cz
* Commerce Media s.r.o.
* Lovosická 711/30, 190 00 Prague 9, Czech Republic
* Terms of service: https://www.emailcampaigns.eu/documents/terms-and-conditions
* Privacy policy: https://www.emailcampaigns.eu/documents/privacy-policy

No contact data is synchronized until the site administrator saves valid credentials. Frontend tracking options are disabled by default. Individual synchronization and tracking features can be disabled in **WooCommerce → Settings → Emailcampaigns.eu**.

== Screenshots ==

1. Enter the Emailcampaigns.eu account email address and API hash to configure the connection.
2. Create the four contact groups used for WooCommerce synchronization.
3. Configure contact synchronization and cart, order and website activity tracking.
4. Customize the newsletter opt-in checkbox for classic and block-based checkout.
5. Review synchronization and diagnostic information in the built-in log viewer.

== Changelog ==

= 1.1.10 =
* Aligned runtime `get_option()` fallbacks with the defaults configured in Settings.
* Changed the fallback values for cart and page visit tracking from enabled to disabled.
* Ensured that no tracking script loads on a fresh installation before the administrator saves the relevant options.
* Ensured that the starter tracking script loads only when a tracking key is configured.

= 1.1.9 =
* Updated the Terms of Service and Privacy Policy URLs in `readme.txt`.

= 1.1.8 =
* Set all frontend tracking and opt-in defaults to disabled.
* Removed automatic tracking key retrieval.
* Added contributors to `readme.txt`.

= 1.1.7 =
* Shortened the description to comply with the WordPress.org 150-character limit.

= 1.1.6 =
* Added translator comments and ordered placeholders.
* Replaced direct file deletion with `wp_delete_file()`.
* Added an English short description.
* Removed manual `load_plugin_textdomain()` usage.
* Prefixed global variables in the uninstall process.
* Added `phpcs:ignore` comments for legitimate false positives.

= 1.1.5 =
* Enabled the newsletter checkbox option by default.
* Set the checkbox default state to selected.
* Added new GDPR-friendly default checkbox text.

= 1.1.4 =
* Changed the text domain to `emailcampaigns-eu`.
* Renamed translation files to match the WordPress.org slug.
* Updated compatibility information to WordPress 7.0.
* Updated Czech translations.

= 1.1.3 =
* Changed the plugin header to the official name Emailcampaigns.eu.
* Added localized Emailkampane.cz branding for Czech and Slovak users.
* Added localized plugin URI and description.
* Added a documentation link to the plugin list in WordPress administration.
* Improved Czech translations.

= 1.1.2 =
* Improved locale fallback for non-Czech and non-Slovak administration languages.
* Updated the newsletter checkbox text to use the current locale dynamically.
* Replaced the stored default checkbox text with a placeholder.

= 1.1.1 =
* Added an English fallback for non-Czech and non-Slovak locales.
* Updated the English brand name to Emailcampaigns.eu.
* Moved the tracking key refresh button next to the tracking key field.
* Added a warning when connection verification succeeds but the tracking key is missing.
* Added tracking key status information.
* Added four Czech and English information and documentation links to the welcome notice and settings header.
* Improved bulk synchronization status handling so that an empty synchronization is distinguished from an active process.
* Increased the width of the first settings column for better readability.
* Added record IDs to bulk synchronization error logs.
* Added `DOKUMENTACE.md` with installation, configuration, hooks and troubleshooting information.
* Updated all 147 Czech and English translation strings.

= 1.1.0 =
* Added the `X-Consumer-Identification: WP_WOOCOMMERCE` header to all requests sent to `api.emailkampane.cz`.
* Added protected system contact groups using `protected: "D"` and a unique `protected_type`.
* Added automatic tracking key retrieval from `tr-web.emailkampane.cz/tracking-code` after credentials are saved, together with manual refresh.
* Added background bulk synchronization through Action Scheduler without a database-size limit, including progress information and cancellation.

= 1.0.0 =
* Initial stable release.
* Added contact synchronization and cart and order tracking.
* Added newsletter checkbox support for classic and block checkout.
* Added the log viewer, bulk synchronization and privacy integration.
