=== CampaignBars Announcement Manager ===
Contributors: pluginsshop
Tags: announcement bar, notification bar, countdown, coupon, campaigns
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 8.1
Stable tag: 1.1.3
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Plan and publish targeted announcements with private drafts, schedules, countdowns, coupon copying, visibility diagnostics and local reports.

== Description ==

Prepare announcements as private drafts, control where and when published notices appear, and inspect selection rules when a bar does not show.

Use service notices, deadlines or promotions. One eligible campaign appears at a time.

= Campaign publishing and recovery — included in Free =

* Unlimited campaigns, name/message search, status filters and duplication.
* Private drafts separate from publications. Publishing requires its own permission; existing editors do not gain it automatically.
* Expiring real-page previews restricted to their publisher, plus an illustrative editor preview.
* Pause/resume approved copy without publishing edits; emergency pause for all bars.
* Restore 20 retained revisions as drafts; recover trash. Reject stale saves that conflict with another tab.

= Messages, targeting and schedules — included in Free =

* Templates, color presets, top/bottom placement, offsets, link buttons and mobile text.
* Announcements, fixed-deadline countdowns and coupon copying. Copying does not create, validate or apply coupons.
* Page/page-type inclusion/exclusion, device/login targeting and start/end dates in the site timezone.
* Dismissal and once-per-session display. Checkout excluded by default; exclusions override inclusion.

= Visibility diagnostics and measurement — included in Free =

* Inspect publication state, dates, exclusions, device/login rules, dismissal, frequency and competing campaigns for a chosen context.
* Explain the winner or blockers. Simulated inputs do not inspect another visitor or certify theme/CSS/cache delivery.
* Optional local views/clicks by campaign and CSV for the last 30 days. Date filters, comparisons and purchase attribution require Pro.
* Guided consent connection/status and private accept/revoke test. Measurement starts disabled; this is not a consent banner.

Free needs no account, API key, paid service or WooCommerce. No time limit or forced branding. PHP/JS support translations; catalogs are not bundled.

= Optional separate Pro add-on =

[CampaignBars Pro](https://campaignbars.com/pro/) adds WooCommerce shipping progress using store rules, eligible coupon application, purchase attribution, date-filtered reports, advanced audiences, priorities, recurring hours, experiments and team tools. These features are not included in this Free download. Free's contextual Pro examples are read-only demonstrations. Attribution does not prove that a campaign caused extra sales.

== Installation ==

1. Install the ZIP through Plugins > Add New > Upload Plugin.
2. Activate it and open CampaignBars in the admin menu.
3. Choose a template or write a message; configure the optional button, audience and dates.
4. Save draft, inspect the preview/diagnostics, then publish when ready.
5. If reports are wanted, configure measurement and test your consent connection in Settings.
6. Clear page/CDN caches after installation, updates or Pro activation/deactivation. Test your theme, mobile layout and consent tool on staging.

[Setup guide](https://campaignbars.com/guide/) | [Support](https://campaignbars.com/help/)

== Frequently Asked Questions ==

= What happens when two campaigns qualify? =

Free selects the eligible campaign with the highest ID. Editing does not change that order. Diagnostics explains competition; Pro adds priorities.

= Does it work with cached pages? =

Clear old page caches after updates. Small inline discovery runs on public pages and loads the full UI/styles/consent when needed, including new/resumed campaigns. Blocked scripts/requests can prevent display; diagnostics cannot certify cache delivery.

= How do I connect analytics consent? =

Enable measurement only if wanted, select automatic detection or your installed provider, save, and open the private consent test. Accept/revoke through your normal banner. A custom connection sets window.CampaignBarsAnalyticsConsent or dispatches CampaignBarsConsent with detail: {analytics: true}, then false on withdrawal. The test does not grant consent or record measurements.

= Moving from the old campaign-bars package? =

Back up first. In OLD Free Settings, turn OFF Delete plugin data on uninstall, save and verify it is off. Deactivate Pro, then old Free. Delete old Free only with that setting off, or remove its folder over SFTP without running uninstall. Install CampaignBars Announcement Manager and Pro 1.1.3; activate new Free first, then Pro. Campaigns/reports/settings retain their existing storage. Clear caches. Do not activate both Free packages. On WordPress before 6.9, use the Plugins screen; programmatic legacy activation is unsupported. See bundled migration.txt.

== External services and APIs ==

Free makes no server-to-server external API calls, loads no external scripts/fonts/images/analytics and does not contact our licence/update service. WordPress core handles its directory, update and translation requests.

= Requests to your own WordPress site =

* The editor uses REST namespace campaign-bars/v1 for drafts/publications, settings, reports, exports, recovery, private previews and diagnostics. Authenticated requests use WordPress cookies, a REST nonce and route-specific capabilities.
* The browser calls wp-admin/admin-ajax.php: campaignbars_discover checks whether bundled assets are needed; campaignbars_resolve selects a published bar. It sends page ID/type, signed page context, mobile/desktop category, the current URL's utm_campaign value if present, and session seen/dismissed campaign keys. Checks repeat on visible/cached pages even when measurement is off or no campaign exists.
* With measurement enabled and the configured consent condition satisfied, campaignbars_event sends a signed campaign/publication token, view/click type and consent flag to that endpoint. It updates local counters, not an external analytics provider.
* PHP uses WordPress posts/options, capabilities, nonces, cache, WP-Cron, database and translation APIs. JavaScript uses core wp-i18n. Custom tables use the WordPress database prefix.

= Optional local consent connections =

These read existing choices without installing a consent manager, loading its scripts or sending API requests.

* [WP Consent API](https://wordpress.org/plugins/wp-consent-api/): reads local wp_has_consent('statistics'), the recorded statistics choice and change events. A recorded allow choice is required; API availability alone does not grant permission.
* [Cookiebot](https://www.cookiebot.com/): reads already installed Cookiebot.hasResponse, Cookiebot.consent.statistics and consent events. Configure Cookiebot separately; its service has its own [terms](https://www.cookiebot.com/en/terms-of-service/) and [privacy policy](https://www.cookiebot.com/en/privacy-policy/).
* Custom: reads window.CampaignBarsAnalyticsConsent or a local CampaignBarsConsent event. This JavaScript interface is not an external service.

Clicked links make normal browser requests. [CampaignBars website privacy](https://campaignbars.com/privacy/) and [terms](https://campaignbars.com/terms/) apply to that website.

== Privacy and data ==

Measurement is disabled by default. Requiring analytics consent is enabled by default but configurable separately: disabling this requirement permits local counting without a grant. Review your obligations; neither edition guarantees legal compliance.

sessionStorage keys beginning cbars: retain seen/dismissed campaign keys for display frequency/dismissal, independently of analytics consent. Free sets no visitor tracking cookie and stores no names, emails or IPs in analytics tables. Your server and other software can independently process headers, IP addresses and logs.

Aggregate rows contain date, campaign/variant, metric, reporting bucket and quantity. Deduplication stores a hash/timestamp. Daily WP-Cron cleanup targets the last 90 site-calendar days of aggregates and one day of event hashes. Delayed jobs or deactivation can retain data longer. Campaigns, settings, editor user IDs and saved revisions remain until removed; their retention is not 90 days.

Authorized CSV/JSON exports are generated locally on request. Kept exports/backups have separate retention. Aggregate counters have no email-based exporter/eraser. Privacy-notice suggestions are in WordPress's Privacy Policy Guide.

Deactivation preserves data; uninstall preserves it by default. Opting into delete-data removes Free's campaigns, revisions, custom report/event tables, options and capabilities when Free is uninstalled. It does not remove WooCommerce orders/their Pro attribution metadata, server logs, backups or browser data. Pro's additional cookie/order-metadata/removal behavior is documented separately.

== Source and license ==

Readable PHP/JS/CSS is included without a build step. WordPress supplies wp-i18n/dependencies. languages/campaignbars-announcement-manager.pot covers PHP/JavaScript; the text domain and folder slug are campaignbars-announcement-manager. No third-party runtime library or remote executable-code loader is bundled.

GPL-2.0-or-later; LICENSE.txt contains GPL version 2.

== Changelog ==

= 1.1.3 =
* Authorize private previews before disabling page caching.
* Validate and allowlist request/context and campaign configuration fields before extension hooks.

= 1.1.2 =
* Publish matching Free and Pro 1.1.2 packages. Preserve existing features, data and compatibility requirements.


= 0.3.7 =
* Rename Free, match its slug/text domain, and add migration/legacy-activation safeguards. Existing data and integration identifiers are retained.

Earlier changes are in changelog.txt.

== Upgrade Notice ==

= 1.1.3 =
Update Free first, then matching Pro. This release corrects private-preview authorization and input validation.

= 1.1.2 =
Back up first. Replace Free first, then matching Pro without uninstalling. Existing canonical-folder installations need no folder migration. Saved data is retained.


= 0.3.7 =
Read the migration steps before replacing the old campaign-bars package. Turn off its delete-data setting before removal. Activate renamed Free before Pro.
