=== LinkBio Tracker ===
Contributors: AkuyDesign
Tags: link in bio, bio link, social media, link tracking, click analytics
Requires at least: 5.9
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 2.1.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

A Link in Bio page builder for WordPress with click analytics and platform attribution. Own your data — no third-party SaaS required.

== Description ==

**LinkBio Tracker** lets you create a beautiful, Linktree-style landing page on your own WordPress site — with full click analytics built in.

**Why use this instead of third-party service?**

* Your page lives on **your domain** — not someone else's server
* Own your data — full analytics dashboard with no monthly fee
* GDPR-friendly — no external tracking scripts
* Track every click with a 302 redirect through your own server
* No account required, no API keys, no GA4 setup needed

**Free Features**

* Unlimited links per page with drag-and-drop reordering inside **main link sections** (tabbed editor, optional subsection title per section on the live page — same idea as featured blocks)
* Featured sections with large image cards, descriptions, and badges
* Standard link cards with optional thumbnail image or Material icon
* Social icons: main row includes Pinterest and X; extra networks can be edited in the "More social links" column (optional collapsible block on the live page when you enable it in Profile); editor uses main column left and more column right on wide screens, with drag-and-drop between columns
* Multiple social icon styles: filled, outline, and minimal
* Full style customization: background (solid, gradient, or image), typography, text colors, card styles (solid, glass, outline), corner roundness, badge colors
* Japanese (ja) admin and front-end strings included; switch WordPress to Japanese under **Settings → General → Site Language** to use them
* Mobile-first responsive design
* Built-in click stats dashboard with device and country tracking
* ON/OFF pill toggle per link, featured section, and main link section
* Duplicate button for quick row cloning
* Tabbed admin UI for organized editing (Profile, Page Design, Settings)
* No ACF required — all fields are native WordPress meta boxes
* **SEO Control** — Allow search engines to index your link page (disabled by default to keep utility pages out of search results).

**Pro Features**

* **Unlimited Pages** — Create as many link pages as you need (free users get one page).
* **Page Source Tag** — Tag each page with the platform where you share it (TikTok, Instagram, YouTube, Facebook, X, LinkedIn, Pinterest, Threads, Reddit, Snapchat, Twitch, Telegram, WhatsApp, Discord, Bluesky, Mastodon, LINE, Medium, email/newsletter, podcast, website, or a **custom** label). The plugin auto-injects UTM parameters so GA4 correctly attributes traffic — even when in-app browsers strip the referrer.
* **Campaign Attribution Analytics** — See which platform is driving clicks with detailed source breakdowns in your stats dashboard.
* **Link & Section Scheduling** — Set start and end dates/times. Links and sections automatically show and hide on schedule.
* **Duplicate Page** — Clone an entire link page with one click to quickly create variations for different platforms.
* **CSV Export** — Export your click analytics data to CSV for reporting, client presentations, or further analysis.
* **UTM Campaign Builder** — Set utm_source, utm_medium, and utm_campaign per link. Automatically appended to the redirect URL.

== Installation ==

1. Upload the `linkbio-tracker` folder to the `/wp-content/plugins/` directory, or install directly from WordPress.org.
2. Activate the plugin through the **Plugins** menu in WordPress.
3. Go to **Link Pages → Add New** to create your first page.
4. Add your profile info, social links, featured sections, and main links.
5. Visit your page at `yoursite.com/bio/your-page-slug`.

== Frequently Asked Questions ==

= Does this require ACF or any other plugin? =
No. All fields are built with native WordPress meta boxes. No dependencies.

= How does click tracking work? =
Each link uses a 302 redirect through your own server. When a visitor clicks, the plugin records the click (timestamp, device, country) in your database and immediately redirects to the target URL.

= Are Smart Exit or flyout share actions tracked as separate clicks? =
Loading your link page records one **page view** in analytics. Taps on **Share to open in browser**, **Share this page**, **Copy link** (the top-right flyout or the Smart Exit overlay), or the share sheet / copy actions they trigger are **not** stored as extra rows. Only **outbound** clicks through your `/go/...` redirect are recorded that way, alongside `page_view`.

= Where do I see my click stats? =
Go to **Link Pages → Click Stats** in your WordPress admin.

= Can I customize the look of my page? =
Yes. You can change the background (solid color, gradient, or image), page font, text colors, card styles (solid, glass, outline), corner roundness, social icon styles, and badge colors — all from the Page Design tab.

= Can I use icons instead of images for links? =
Yes. Each main link has a "Link Visual" option where you can choose None, Icon (from a library of 80+ Material icons), or Image.

= What is the Page Source Tag? =
A Pro feature that lets you label each page with the platform where you share its URL (many presets such as TikTok, Instagram, LinkedIn, YouTube, or your own **Custom** label). The plugin auto-appends UTM parameters so your analytics always show the correct traffic source — even when platforms strip the referrer header.

= Can I schedule links to appear and disappear? =
Yes, with Pro. Each link and featured section has start/end date-time fields. Outside the scheduled window, the item is automatically hidden.

= Is there a limit on how many links I can add? =
No. Free users can add unlimited links, featured sections, and main link sections per page.

== Screenshots ==

1. Link page on mobile — clean, branded layout on your own domain.
2. Admin editor — tabbed interface with Profile, Page Design, and Settings.
3. Click Stats dashboard — see clicks, devices, and countries.
4. Featured sections with image cards and badges.
5. Style customization — card styles, fonts, colors, and social icon options.

== Changelog ==

= 2.1.1 =
* **Main Links — Tags** — Optional **URL** per tag: chip is a link when a URL is set, otherwise a plain chip. Admin rows use Label + URL; legacy string-only tags still load.
* **Main Links — Style** — **Text block**, **Tags** (outer + chip), **Outer box**, and **FAQ** style controls moved from Featured → Style to **Main Links → Style** (same option keys; featured-only embed styling stays under Featured → Style).
* **Live page** — Main **Text** and **FAQ** use dedicated classes (`slp-main-link-aux--text`, `slp-main-link-extra-text`, `slp-main-faq-*`) with the same design tokens as before so main blocks match the options in Main Links → Style.

= 2.1.0 =
* **Versioning** — Canonical release after **2.0.9** is **2.1.0** (project rule: the patch segment runs **`.0`–`.9` only**; do not ship **`2.0.10`** or higher on the third segment).
* **Live page** — Desktop / normal browsers: flyout primary is **Share this page** (Web Share API) with **Copy link** second. In-app WebViews (TikTok, Instagram, Facebook): primary **Share to open in browser** + copy; corner menu **z-index** above Smart Exit, broader ByteDance/TikTok UA hints, **`navigator.share`** payload + panel **touchend** handling, flyout intro aligned with Smart Exit body where applicable.

= 2.0.9 =
* **Live page** — Top-right flyout **primary action** works again in **normal browsers**: **Open in new tab** (`window.open` plus a synthetic `<a target="_blank">` fallback), not only inside TikTok/Instagram/Facebook. In-app WebViews still use **Share to open in browser** + copy.

= 2.0.8 =
* **Live page** — Corner “Share to open in browser” is more reliable: **z-index** above Smart Exit so the menu is not blocked, **broader TikTok / ByteDance UA detection**, **`navigator.share` payload** includes `text`, **touchend** propagation stopped on the flyout panel, and the primary button handler is **always bound** (guards in-app inside the handler). **Flyout intro** default again matches the **Smart Exit body** paragraph (single source of truth in PHP).

= 2.0.7 =
* **Live page** — In-app flyout and Smart Exit: primary action is **Share to open in browser** (opens the system share sheet); second action is **Copy link** only. Removed the duplicate third button. Default visitor copy and Japanese strings updated.

= 2.0.6 =
* **Live page** — In TikTok / Instagram / Facebook in-app browsers, **Open in external browser** (Smart Exit primary button and top-right flyout) now opens the **system share sheet** first (same as **Share link**), so visitors can choose **Open in Safari / Chrome** where URL handoffs and new tabs are blocked.

= 2.0.5 =
* **Smart Exit (Pro)** — Default is now **off** until you enable it on **Settings** (opt-in). Existing pages that never saved the checkbox stay off; turn it on and save if you want the overlay.
* **Live page** — **Open in external browser** (Smart Exit modal and top-right menu) uses **iOS Safari** (`x-safari-https` / `x-safari-http`) and an **Android VIEW intent** (Chrome + `S.browser_fallback_url`) when TikTok, Instagram, or Facebook in-app WebView is detected, instead of `window.open`, which those apps often trap or reload in-place.

= 2.0.4 =
* **Admin** — Featured / Main Links section tabs: drag handle now uses a wrapper layout so **reordering works** in browsers that block dragging inside `<button>` elements.

= 2.0.3 =
* **Admin — Featured & Main Links** — Drag the **grip** on a section tab to reorder sections (same order as on the live page). Duplicate section no longer hides the link editor; **Share** primary styling preserved for main links when duplicating.
* **i18n** — Toolbar hints and “Drag to reorder sections”; run `python3 tools/build-l10n.py` after edits.

= 2.0.2 =
* **Smart Exit (Pro)** — In-app browser overlay as a bottom sheet; primary **Open in external browser** (new tab) and separate **Share link**; customizable modal headline, body, CTA label, and corner flyout intro with placeholders matching live defaults.
* **Corner menu** — Share / copy always available; **Open in external browser** shown only when Instagram, Facebook, or TikTok in-app WebView is detected; flyout title and intro adjust for normal browsers.
* **Settings (admin)** — **Page Source Tag** block moved above **Smart Exit Layer** on the Settings tab.
* **Docs & l10n** — FAQ clarifies page views vs Smart Exit / flyout taps; Japanese strings and POT/PO/MO refreshed (`python3 tools/build-l10n.py`).

= 2.0.1 =
* **Main Links** — Editor matches **Featured**: multiple **main link sections** with sub-tabs, **+ Add main link section**, per-section **Section title**, drag-and-drop links inside each section, duplicate/remove section, and ON/OFF visibility per section. No separate global “section heading” field for main links; optional legacy page-level heading meta is cleared on save.
* **Data & redirects** — On save, sections flatten to the existing `_lbt_link_{n}_*` post meta plus new `_lbt_link_boxes_layout` JSON (title, hidden, count per section). Legacy single-list pages **migrate automatically** when you open and save the page. Public `/go/{page}/link_{n}` indices stay aligned with the flattened order.
* **Live page** — One block per section; each block can show its **Section title** as a subsection heading. Page Design **Section heading color** applies to those titles (and to the rare legacy global links heading if present).
* **Admin** — `admin.js` / `admin.css` updated for link subtabs, sortable rows inside sections, and submit-time reindexing. Japanese strings extended in `tools/ja-strings.json`; run `python3 tools/build-l10n.py` after edits.

= 2.0.0 =
* **Japanese (ja) localization** — `languages/linkbio-tracker-ja.mo` / `.po`, template `linkbio-tracker.pot`, and translator source `tools/ja-strings.json`. WordPress 4.6+ loads plugin translations automatically from `languages/` (`Domain Path` in the plugin header). Admin JavaScript strings are passed through `wp_localize_script`. Run `python3 tools/build-l10n.py` after editing `tools/ja-strings.json` to regenerate POT/PO/MO.

= 1.9.9 =
* Page Design: **Featured badge colors** now has a separate background and text color pair for **Style 2** featured cards (Style 1 keeps the original controls).

= 1.9.8 =
* Featured cards: title and description use **left-aligned** lines by default; the text block stays **vertically centered** in the content area beside the thumbnail (not `text-align: center` on the column). Page Design **Featured text (no section image)** defaults to Left; **Center lines** still sets centered lines for text-only cards only.

= 1.9.7 =
* Featured cards: reverted the badge-in-flow layout to the previous **fixed top-right** badge on the card; text column uses vertical centering with padding so copy stays clear of the badge (stable on wide screens). Style 3 again uses the vertically centered pill on the right.

= 1.9.6 =
* Featured cards with a **badge**: (superseded by 1.9.7) badge row layout experiment.

= 1.9.5 =
* Pro — **Page Source Tag**: many more built-in platforms (LinkedIn, Pinterest, Threads, Reddit, Snapchat, Twitch, Telegram, WhatsApp, Discord, Bluesky, Mastodon, LINE, Medium, email/newsletter, podcast, website) plus **Custom** as before. Saves are validated against the preset list.

= 1.9.4 =
* Featured links with **no section image**: balanced horizontal padding (no empty “image column” gap), and a Page Design control **Featured text (no section image)** to align title/description **Center** or **Left** (same idea as main links text-only alignment).

= 1.9.3 =
* Developer: `build.sh --pro` now packages **LinkBio Tracker Pro** inside a `linkbio-tracker-pro/` folder (WordPress rejects zips whose files sit at the archive root). Local Pro zips also define `LINKBIO_TRACKER_FORCE_PRO` and set Freemius `is_premium` so Pro-gated UI works from the build without editing `is_pro()` by hand.

= 1.9.2 =
* Profile → Social Links: new checkbox **Show “More social links” on the live page** (off by default). When off, the expandable block is hidden; URLs in the more column remain saved. Enable when you want visitors to see that section.

= 1.9.1 =
* Social editor: "More social links" box on the right of the main column on wide screens; drag any network between main row and more section (placement is saved per column). Existing pages still load from the legacy combined order until you save.

= 1.9.0 =
* X (Twitter) is a main-row social link with Pinterest and other majors.
* Social editor: "More social (accordion)" renamed to "More social links"; no "(accordion)" in labels.
* Wide layout: more-social box on the left, main social links column on the right; narrow screens keep main links first.

= 1.8.9 =
* Social (accordion / "more" column): Telegram, WhatsApp, Discord, and GitHub URL fields with icons.

= 1.8.8 =
* Social admin: two-column layout for main vs. more networks; removed per-field "(more section)" labels.
* Pinterest moved to the main social icon row; extra networks were Threads, X, LINE, Reddit, Tumblr (X moved to main row in 1.9.0).

= 1.8.7 =
* Main link cards without an image or icon use more comfortable horizontal padding.
* Page Design → Main Links: choose link text alignment (center or left) for text-only cards; cards with a thumbnail or icon keep left-aligned text.

= 1.8.6 =
* Social: LINE, Reddit, and Tumblr fields; LinkedIn remains in the main row.
* Secondary networks (at the time: Pinterest, Threads, X, LINE, Reddit, Tumblr) rendered in a closed-by-default "More social links" section below main link buttons. (Pinterest moved to the main row in 1.8.8.)
* Drag-and-drop order for all social fields in the editor (saved order applies within primary and within secondary groups).

= 1.8.5 =
* Initial release.

== Credits ==

This plugin uses the following third-party libraries. Full license texts are in `assets/licenses/`.

**Font Awesome Free 6.5.1**
Copyright (c) Fonticons, Inc. — https://fontawesome.com
Icons: CC BY 4.0 | Fonts: SIL OFL 1.1 | Code: MIT
https://fontawesome.com/license/free

**Google Material Symbols (Material Icons)**
Copyright (c) Google LLC — https://fonts.google.com/icons
License: Apache License 2.0
https://www.apache.org/licenses/LICENSE-2.0

**Chart.js 4.4.0**
Copyright (c) 2014-2024 Chart.js Contributors — https://www.chartjs.org
License: MIT License
https://opensource.org/licenses/MIT

**Google Fonts**
Copyright (c) Google LLC — https://fonts.google.com
Individual fonts are licensed under SIL OFL 1.1 or Apache License 2.0.
Fonts are loaded at runtime via the Google Fonts API; no font files are bundled.

**jQuery UI — Sortable**
Copyright (c) jQuery Foundation — https://jqueryui.com
License: MIT License
Provided by WordPress core; not bundled with this plugin.

== Upgrade Notice ==

= 2.1.1 =
Main Links tags can include optional URLs; tag/text/FAQ **appearance** is edited under **Main Links → Style**. Clear any page cache after update. No database migration required.

= 2.1.0 =
Follows **2.0.9** in the project’s version scheme (**2.0.10+** is not used). Desktop flyout: **Share this page** + **Copy link**; in-app behaviour and corner-menu fixes as in the changelog. No database migration required.

= 2.0.9 =
Normal browsers: flyout shows **Open in new tab** again (not in-app only). No database migration required.

= 2.0.8 =
Corner menu works above Smart Exit; flyout default intro matches Smart Exit body again. Clear cache after update. No database migration required.

= 2.0.7 =
In-app menu: **Share to open in browser** (share sheet) plus one **Copy link** row — no duplicate actions. No database migration required.

= 2.0.6 =
In-app **Open in external browser** now opens the **share sheet** first (like **Share link**), which TikTok and similar WebViews allow; choose your browser from the sheet. No database migration required.

= 2.0.5 =
Smart Exit is **off by default** until you check the box on **Settings** and save. In-app **Open in external browser** now uses platform URL handoffs (Safari / Chrome) instead of a new tab, which TikTok and similar WebViews often block.

= 2.0.4 =
If section tab drag did nothing in 2.0.3, update to this build (tab markup fix). No database migration required.

= 2.0.3 =
Featured and Main Links section tabs can be reordered by dragging the menu grip on each tab. No database migration required.

= 2.0.2 =
Smart Exit and the top-right share menu are refined for in-app browsers (Instagram, TikTok, Facebook). Pro users can customize modal and flyout copy on **Settings**. No database migration required.

= 2.0.1 =
Main Links are now edited in **sections** (like Featured). Existing links load into one or more sections; save once to write the new layout. Click tracking URLs (`/go/.../link_n`) keep the same order after save.

= 1.8.5 =
Freemium update — Pro features (scheduling, UTM builder, page source tag) are now visible with upgrade prompts. All free features remain fully functional.
