VeeFriends.LinkShortener 5.0.13

There is a newer version of this package available.
See the version list below for details.
dotnet add package VeeFriends.LinkShortener --version 5.0.13
                    
NuGet\Install-Package VeeFriends.LinkShortener -Version 5.0.13
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="VeeFriends.LinkShortener" Version="5.0.13" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="VeeFriends.LinkShortener" Version="5.0.13" />
                    
Directory.Packages.props
<PackageReference Include="VeeFriends.LinkShortener" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add VeeFriends.LinkShortener --version 5.0.13
                    
#r "nuget: VeeFriends.LinkShortener, 5.0.13"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package VeeFriends.LinkShortener@5.0.13
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=VeeFriends.LinkShortener&version=5.0.13
                    
Install as a Cake Addin
#tool nuget:?package=VeeFriends.LinkShortener&version=5.0.13
                    
Install as a Cake Tool

VeeFriends.LinkShortener 📎✨

.NET Version License

VeeFriends.LinkShortener is a modern, production-ready .NET 9 library and service for creating, managing, and tracking short links. It features robust analytics, QR code generation, and seamless integration with Azure Table Storage, Cloudinary, and Link Preview APIs. Designed for extensibility and testability, it supports dependency injection and is fully covered by automated tests.


Features

  • Short Link Creation: Generate branded, expiring, and analytics-enabled short URLs.
  • Analytics Tracking: Collects and stores detailed analytics for each link visit, including IP, user agent, geo, and device info.
  • QR Code Generation: Automatically generates QR codes for each short link.
  • Link Preview Integration: Fetches and stores link preview metadata (title, description, image).
  • Cloudinary Support: Stores and serves QR codes and images via Cloudinary.
  • Azure Table Storage: Fast, scalable, and cost-effective storage for links and analytics.
  • Extensible & Testable: Built for dependency injection and easy extension.
  • .NET 9 & C# 13: Uses the latest .NET and C# features.

Installation

Install the VeeFriends.LinkShortener NuGet package in your project:

dotnet add package VeeFriends.LinkShortener


Usage

1. Configuration

Configure the necessary services in your Startup.cs or Program.cs file:

using Microsoft.Extensions.DependencyInjection; 
using VeeFriends.LinkShortener;

var services = new ServiceCollection(); 

services.AddLinkShortener(options => { 
    options.AzureTableConnectionString = "your-azure-table-connection-string"; 
    options.CloudinaryApiSecret = "your-cloudinary-api-secret"; 
    options.CloudinaryApiKey = "your-cloudinary-api-key"; 
    options.CloudinaryCloudName = "your-cloudinary-cloud-name"; 
    options.LinkPreviewApiKey = "your-link-preview-api-key"; 
    options.HostUrl = "https://your-shortener-domain.com"; 
});

Inject the LinkService and use its methods to create, update, delete, and retrieve links:


public class MyLinkService 
{ 
    private readonly LinkService _linkService;

    public MyLinkService(LinkService linkService)
    {
        _linkService = linkService;
    }

    public async Task CreateAndTrackAsync()
    {
        // Create a new short link
        var link = await _linkService.CreateLink(
            "My Campaign",
            "https://veefriends.com",
            slug: null,
            expiresAt: DateTime.UtcNow.AddDays(7),
            CancellationToken.None
        );

        // Retrieve by slug
        var retrieved = await _linkService.GetLinkBySlug("your-slug", CancellationToken.None);

        // Track a view (analytics)
        var request = new HttpRequestMessage(HttpMethod.Get, link.ShortUrl);
        await _linkService.TrackViewBySlug("your-slug", request, CancellationToken.None);

        // Get analytics
        var analytics = await _linkService.GetAnalyticsBySlug("your-slug", CancellationToken.None);
    }
}

3. Analytics

Analytics are automatically tracked for each link visit, including:

  • Request method and URL
  • IP address and geo lookup (country, region, city)
  • User agent, device type, OS, and browser
  • Referrer

Retrieve analytics for a link:

var analytics = await linkService.GetAnalyticsBySlug("your-slug", CancellationToken.None); 

foreach (var entry in analytics) 
{ 
    Console.WriteLine($"{entry.Timestamp}: {entry.IpAddress} - {entry.UserAgent}"); 
}

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
5.0.25 292 6/25/2025
5.0.24 131 6/24/2025
5.0.23 137 6/24/2025
5.0.22 135 6/24/2025
5.0.21 135 6/24/2025
5.0.20 136 6/23/2025
5.0.19 94 6/20/2025
5.0.18 84 6/20/2025
5.0.17 139 6/19/2025
5.0.16 137 6/17/2025
5.0.15 136 6/17/2025
5.0.14 134 6/17/2025
5.0.13 132 6/17/2025
5.0.12 136 6/16/2025
5.0.8 135 6/16/2025
5.0.7 139 6/16/2025
5.0.6 133 6/16/2025
5.0.4 134 6/16/2025
5.0.3 134 6/16/2025
5.0.2 183 6/13/2025
5.0.1 191 6/13/2025