# Custom Link Shortener

Contributors: Lukastech
Tags: url-shortener, custom-links, click-tracking, links-shortener, links
Requires at least: 5.0 
Tested up to: 6.8
Stable tag: 1.4.3 
License: GPLv2 or later  
License URI:** https://www.gnu.org/licenses/gpl-2.0.html  

Advanced URL shortener for WordPress with analytics, link rotation, location tracking, random redirects, and password protection.

## Features

- 🚀 Create custom short URLs (e.g., `yoursite.com/go/product`)
- 📊 Detailed click analytics with:
  - Visitor IP addresses
  - Location data (country/city)
  - User agents
  - Timestamps
- 🔄 URL rotation (randomize destinations)
- 🔒 Password protection for private links
- 📁 CSV export for all analytics data
- ✏️ Edit existing short URLs
- 🗑️ Delete short URLs with confirmation
- 🎨 Clean WordPress admin interface
- 🔄Create One Url that redirects to multiple posts on your website.

## Installation

1. Upload the plugin files to `/wp-content/plugins/custom-link-shortener`
2. Activate the plugin through the 'Plugins' menu in WordPress
3. Navigate to WP Shortener in your admin menu to create links

## Usage

### Creating Short Links
1. Go to Custom Link Shortener in your admin menu
2. Enter:
   - Your preferred alias (e.g., "product")
   - Destination URL(s) (one per line for rotation)
3. Optional: Enable rotation or set a password
4. Enable random post redirects
5. Click "Create Short Link"

### Viewing Analytics
1. Go to Custom Link Shortener → Analytics
2. View all links with click counts
3. Click "View" on any link to see detailed stats
4. Export data as CSV when needed

### Managing Links
- Edit: Change destinations, rotation, or password
- Delete: Remove short links (with confirmation)
- Test: Verify your links work before sharing

## Advanced Features

### URL Rotation
When enabled with multiple destinations:
- Visitors get randomly redirected to one of the URLs
- All clicks are still tracked accurately

### Password Protection
- Set a password when creating/editing links
- Visitors must enter password before redirect
- Works with both GET and POST requests

### Random blog article in one short link
- Query your WordPress database for all published posts
- Randomly select one post from the available options
- Redirect the visitor to that post's permalink
- Track the redirect for analytics purposes
#### Use Cases

- Content Discovery: Help visitors explore your older or less-visited content
- Newsletter Links: Add a "Random Article" link to your email newsletters
- Social Media: Share surprise content links on social platforms
- Website Navigation: Include a "Surprise Me" button in your site navigation
- Content Marketing: Create engaging campaigns around random content discovery

## Screenshots

1. Create Short Link  
   !(screenshot-creation.png)

2. Analytics Overview  
   !(screenshot-analytics.png)

3. Detailed Click Data 
   !(screenshot-details.png)

== External Services ==

This plugin uses ipapi.co to determine visitor location information for analytics.

What data is sent:
- Visitor's IP address (only when a link is clicked)
- No personal data is sent

When data is sent:
- Only when a short link is clicked by a visitor

Service information:
- Terms: https://ipapi.co/terms/
- Privacy: https://ipapi.co/privacy/

## Frequently Asked Questions

### Can I use custom slugs?
Yes! You can choose any alphanumeric slug (letters, numbers, hyphens, underscores).

### How do I track more visitor data?
The plugin automatically tracks:
- IP address
- Approximate location
- Device/browser (via user agent)
- Timestamp

### Can I export my analytics?
Yes! Click "Export CSV" on any analytics page to download all data.

### What happens if I delete a short URL?
All associated data (destinations, click records) are permanently deleted.

## Changelog

### 1.4.3 (June 2025)
- Redirect users to random posts on the website via a shortlink
- Total Redirects: Count of how many times the random link was used
- Unique Visitors: Number of unique users who clicked the random link
- Popular Destinations: Which posts are being randomly selected most often
- Enhanced U.I

### 1.4.2 (May 2025)
- Fixed redirect functionality
- Enhanced password protection
- Improved mobile responsiveness

### 1.4.0 (May 2025)
- Complete UI redesign
- Added CSV export
- Fixed deletion bugs

### 1.3 (April 2025)
- Initial release with core features

## Support

For support, please email support@lukastechs.com.

---

Pro Tip: For maximum compatibility, always test new short links before sharing them widely!