# inPIPE by Seresa

Contributors: seresa8  
Tags: UTM tracking, UTM encoding, dataLayer, server-side tracking, ad blocker bypass  
Requires at least: 6.4  
Tested up to: 6.8  
Requires PHP: 8.3  
Stable tag: 1.0.1 
License: GPL-2.0+  
License URI: https://www.gnu.org/licenses/gpl-2.0.html  

Generate and manage UTM parameters for enhanced tracking with dataLayer integration.

## Description

WP inPIPE by Seresa allows you to generate, store, and manage UTM parameters—both plain and coded. The plugin automatically decodes coded UTM query strings when visitors land on your website, pushing the full UTM data to the dataLayer. This helps bypass ad blockers and improves tracking in Google Analytics, Facebook Ads, and other platforms.

### Key Features

- 🔹 Generate & manage UTM query strings with ease
- 🔹 Supports both **plain and coded UTM parameters**
- 🔹 Decodes coded UTM links on-site and sends data to the dataLayer
- 🔹 Reduces tracking disruptions caused by ad blockers
- 🔹 Works with GA4, GTM, Facebook Ads & more

**Use WP inPIPE for more reliable UTM tracking and better data collection!**

## Installation

1. Upload the plugin folder to your WordPress plugin directory (`wp-content/plugins/`).
2. Activate the plugin through the **Plugins > Installed Plugins** menu in WordPress.

## Configuration

- Navigate to **Admin Dashboard > inPIPE** to manage plugin settings.
- Enable automatic UTM processing in the settings panel.
- Use the **UTM Coder** to create, edit, or delete UTM query strings.

## Development

For development setup and WordPress logs monitoring, see:
- [Development Setup](README.md#development-setup)
- [WordPress Logs Monitoring](view-wordpress-logs.md)

## Frequently Asked Questions

### Can I use this plugin just to generate UTM parameter query strings?

Yes! The plugin allows you to easily generate **UTM parameter query strings** for your marketing campaigns. You can create both **plain and coded UTM query strings** with simple click options. If you only need to generate and use UTM parameters without decoding, you can do so without enabling the decoding feature.

### Can I use plain UTM parameters instead of coded ones?

Yes! The plugin supports both **plain and coded UTM parameters**. If you don't enable decoding, your standard UTM parameters will work as usual. If you want extra protection against ad blockers, you can enable decoding in the plugin settings.

### How do I enable coded UTM decoding?

Go to **Settings > WP inPIPE** and turn on the option for **Coded UTM Processing**. When enabled, the plugin will detect and decode coded UTM query strings, replacing them with the full UTM parameters in the URL bar and pushing them to the dataLayer.

### How does this help with Google Tag Manager (GTM)?

By pushing **decoded UTM parameters** directly into the **dataLayer**, Web GTM can receive the data without requiring extra configurations to extract and manage UTM values. This simplifies tracking setup and ensures cleaner data in your analytics.

## External Services

This plugin connects to external services hosted by Seresa.io for the following purposes:

1. **Subscription Verification**
   * What: The plugin connects to https://sub.seresa.io/api/verify/ to validate subscription codes
   * When: This occurs only when a user enters a subscription code in the admin panel to activate premium features
   * Data sent: Subscription code entered by the user, site URL, and WordPress version
   * Purpose: To verify the validity of subscription purchases and enable premium features
   * Provider: Seresa.io - [Terms of Service](https://seresa.io/terms) and [Privacy Policy](https://seresa.io/privacy)

2. **Package Installation**
   * What: The plugin connects to https://sub.seresa.io/api/inpipe-premium-packages/ to download premium components
   * When: This occurs only after subscription verification when the user initiates the installation of premium features
   * Data sent: Verified subscription code, site URL, WordPress version, and PHP version
   * Purpose: To securely download and install authorized premium components
   * Provider: Seresa.io - [Terms of Service](https://seresa.io/terms) and [Privacy Policy](https://seresa.io/privacy)

3. **Transmute Engine (Premium Feature)**
   * What: Premium users' event data is processed through Transmute Engine, a server-side event processing service
   * When: When events are triggered on your website (page views, clicks, form submissions, etc.)
   * Data sent: Event data, UTM parameters, and tracking information
   * Purpose: To process and route event data to your configured third-party services
   * How it works: Transmute Engine acts as a first-party server to your website, temporarily processing data without permanent storage, and forwarding it to your specified endpoints
   * Provider: Seresa.io - [Terms of Service](https://seresa.io/terms) and [Privacy Policy](https://seresa.io/privacy)

No data is shared with third parties beyond Seresa.io, and all connections use secure HTTPS encryption. Users can choose not to use premium features, in which case no external connections will be made.

## Third-Party Libraries

This plugin uses the following third-party libraries:

1. **Vue.js**
   * What: A progressive JavaScript framework for building user interfaces
   * Website: https://vuejs.org/
   * License: MIT License - https://github.com/vuejs/vue/blob/main/LICENSE

2. **Vue Toastification**
   * What: Toast notification library for Vue.js
   * Website: https://github.com/Maronato/vue-toastification
   * License: MIT License

3. **Lucide Icons**
   * What: Beautiful & consistent icon toolkit for Vue.js
   * Website: https://lucide.dev/
   * License: ISC License - https://github.com/lucide-icons/lucide/blob/main/LICENSE

All third-party libraries used are compatible with the GPL-2.0+ license of this plugin.

## Support

For **free users**: Report issues on our GitHub page:
🔗 [GitHub Issues](https://github.com/seresa8/inPIPE-by-Seresa-issues/issues)

For **general inquiries**, contact us at [support@seresa.io](mailto:support@seresa.io).

For **premium users**: Get priority support at 🔗 [seresa.io/support](https://seresa.io/support).

## Project Structure Overview

```
inpipe/
├── includes/                 # Core and logic for WordPress side
│   ├── core/                 # Shared PHP logic (DB, REST, Vue bootstrapping)
│   │   ├── api/              # REST API endpoints
│   │   ├── utils/            # Logging, helpers
│   │   └── vue/              # Vue translation boot logic
│   └── free/                 # Free-only handlers
│       ├── premium-upgrade/  # Handles upgrade injection logic
├── src/                      # Vue 3 application source
│   ├── admin/
│   │   ├── components/       # Vue components
│   │   │   ├── base/         # Atomic UI components
│   │   │   └── free/         # Free features
│   │   ├── utils/            # translate.js, helpers
│   │   └── main.js          # Vue entry point
│   └── types/                # TypeScript type definitions
├── dist/                     # Built JS and CSS (compiled from src/)
├── languages/                # .pot, .po, .mo translation files
├── public/                   # Public-facing assets
│   └── assets/
│       └── images/           # Plugin images
├── uninstall.php             # Cleanup on plugin uninstallation
├── inpipe-by-seresa.php      # Main plugin bootstrap file
```

## Development Setup

### 1. Clone the Repo

```
git clone https://github.com/seresa8/inpipe-by-seresa.git
cd inpipe-by-seresa
```

### 2. Install Dependencies

```
npm install
composer install
```

### 3. Dev Server (Vite)

```
npm run dev
```

Builds and serves the Vue app with HMR. Output goes to `dist/`.

### 4. Build for Production

```
npm run build
```

Minifies Vue files and outputs to `dist/`.

## i18n & Translations

* PHP strings use `__()` and `_e()`
* Vue app uses `window.inPipeTranslations` loaded via `inpipe-vue-translations.php`
* Translation helper: `src/admin/utils/translate.js`

### Generate .pot

```
wp i18n make-pot ./ ./languages/inpipe-by-seresa.pot --exclude=node_modules,dist,vendor,src
```

## Build & Package Checklist

Before packaging:

* Run `npm run build`
* Run `wp i18n make-pot`
* Run `phpcs`
* Remove any test files or dev-only code
* Zip the plugin directory **excluding** `node_modules`, `src/`, etc.

## Changelog

### 1.0.1
**Major Enhancement: Unified Premium Detection System**

= NEW FEATURES =
* **Status Manager Integration**: Implemented centralized premium detection system for consistent plugin behavior
* **Enhanced Uninstall Safety**: Added intelligent premium detection during uninstallation with robust fallback mechanisms
* **Improved API Reliability**: Unified premium detection across all API endpoints and initialization

= IMPROVEMENTS =
* **Premium Detection Consolidation**: Replaced 13+ scattered premium detection points with single unified system
  - API Endpoints Free: 5 detection points → 1 unified Status Manager call (80% complexity reduction)
  - API Initialization: 3 detection points → unified premium detection
  - Smart Uninstaller: Enhanced with Status Manager integration plus 4 robust fallback methods
* **Enhanced Error Handling**: Added comprehensive safety checks and graceful degradation across all components
* **Debug Logging**: Improved debugging capabilities with detailed Status Manager integration logging
* **Code Maintainability**: Centralized premium logic reduces maintenance overhead and improves consistency

= TECHNICAL ENHANCEMENTS =
* **API Endpoints**: Updated `handle_subscription_webhook()`, `handle_premium_integration()`, `handle_premium_install()`, and `handle_premium_install_status()` methods with unified premium detection
* **Backup System**: Enhanced backup creation and restoration with Status Manager integration
* **Uninstall Process**: Added `is_uninstall_context_safe()` method for secure Status Manager usage during plugin removal
* **WordPress Standards**: Maintained full compliance with WordPress coding standards and best practices

= SECURITY & RELIABILITY =
* **Uninstall Context Safety**: Added pre-flight checks before Status Manager usage during uninstallation
* **Database Validation**: Enhanced database connection verification and WordPress function availability checks
* **Graceful Degradation**: Improved fallback mechanisms when Status Manager unavailable
* **Exception Handling**: Comprehensive error handling prevents fatal errors during premium detection

= COMPATIBILITY =
* **Backward Compatibility**: All existing functionality preserved with zero breaking changes
* **WordPress Core**: Fully compatible with WordPress 5.0+ requirements
* **PHP Compatibility**: Maintains PHP 7.4+ compatibility with improved error handling
* **Performance**: Enhanced premium detection with minimal performance overhead

= DEVELOPER NOTES =
* **Class Documentation**: Updated DocBlocks with @since 1.0.1 tags for all modified methods
* **API Preservation**: 100% API functionality maintained - all endpoints continue to work identically
* **Hook Integration**: All WordPress action and filter hooks preserved without modifications
* **Debug Support**: Enhanced debugging capabilities for troubleshooting premium detection issues

= FILES UPDATED =
* `uninstall.php` – Stripped constructor and 4 internal methods: smart uninstaller setup and safety validation
* `inpipe-by-seresa.php` – Removed 15 init, activation, component loading, and logging functions
* `includes/core/class-inpipe-vue-admin.php` – Stripped Vue admin controller constructor and 4 methods for cached settings and connections
* `includes/core/class-inpipe-status-manager.php` – Removed 21 premium detection, validation, and mode management methods
* `includes/core/class-inpipe-settings-manager.php` – Stripped constructor and `load_settings` logic
* `includes/core/class-inpipe-feature-manager.php` – Stripped `InPipe_Feature_Manager` core feature loader
* `includes/free/premium-upgrade/class-inpipe-simple-subscription-verifier.php` – Removed `verify_with_server`
* `includes/free/premium-upgrade/class-inpipe-premium-integrator.php` – Removed `integrate_package` and `rollback_integration`
* `includes/free/premium-upgrade/class-inpipe-package-installer.php` – Stripped 6 installer and package handling methods
* `includes/free/premium-upgrade/class-inpipe-backup-manager.php` – Stripped constructor and `ensure_wp_constants`
* `includes/core/api/inpipe-api-init.php` – Stripped `inpipe_init_api_endpoints`
* `includes/core/api/class-inpipe-api-endpoints-free.php` – Stripped 8 methods covering public UTM validation, premium integration, webhook handling, backup, and install status

= UPGRADE NOTES =
* **Automatic Enhancement**: Existing installations automatically benefit from improved premium detection
* **No Configuration Required**: Changes are transparent to end users
* **Plugin Stability**: Enhanced reliability for both free and premium installations
* **Debugging Improvements**: Better error reporting and diagnostic capabilities

### 1.0.0
- Initial release
- Core UTM tracking, encoding and decoding functionality
- Google Tag Manager (GTM) and dataLayer integration
- Support for both plain and coded UTM parameters
- Basic admin interface with UTM generator and settings
- Ad blocker bypass capabilities

## License

This plugin is licensed under the GNU General Public License v2.0 or later.
For more details, visit: https://www.gnu.org/licenses/gpl-2.0.html