X.Web.UTM 1.0.5

Prefix Reserved
dotnet add package X.Web.UTM --version 1.0.5                
NuGet\Install-Package X.Web.UTM -Version 1.0.5                
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="X.Web.UTM" Version="1.0.5" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add X.Web.UTM --version 1.0.5                
#r "nuget: X.Web.UTM, 1.0.5"                
#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.
// Install X.Web.UTM as a Cake Addin
#addin nuget:?package=X.Web.UTM&version=1.0.5

// Install X.Web.UTM as a Cake Tool
#tool nuget:?package=X.Web.UTM&version=1.0.5                

NuGet version Twitter URL

X.Web.UTM

X.Web.UTM is a versatile .NET library designed to efficiently handle Urchin Tracking Module (UTM) parameters, which are crucial for tracking web traffic sources in digital marketing. This library allows developers to parse, construct, and append UTM parameters to URLs, enhancing the capability to track the effectiveness of online advertising campaigns directly through the URL's query string.

Key Features:

  • Flexible UTM Parameter Management: Easily create and manage UTM parameters with the UrchinTrackingModule class, which supports setting and retrieving properties such as Source, Medium, Campaign, Term, and Content.
  • Dynamic URL Building: Utilize the UTMBuilder class to seamlessly append UTM parameters to existing URIs, ensuring all marketing and tracking information is accurately included in URLs.
  • Robust Error Handling: Implements checks and throws exceptions to prevent errors in URL construction when essential parameters are missing.

Use Cases:

  • Campaign Tracking: Perfect for marketers and developers looking to gauge the effectiveness of various marketing campaigns by tracking where traffic is coming from.
  • A/B Testing: Optimize digital marketing strategies by adjusting UTM parameters for different ad variants and directly measuring performance.

Installation

You can install the library via NuGet:

dotnet add package X.Web.UTM

Usage Samples

1. Building a URL with UTM Parameters

var utm = new UrchinTrackingModule
{
    Source = "google",
    Medium = "cpc",
    Campaign = "spring_sale",
    Term = "running shoes",
    Content = "banner_ad"
};

var uri = new Uri("https://example.com");
var builder = new UTMBuilder();
var resultUri = builder.Build(uri, utm);

Console.WriteLine(resultUri);
// Output: https://example.com/?utm_source=google&utm_medium=cpc&utm_campaign=spring_sale&utm_term=running+shoes&utm_content=banner_ad

2. Parsing UTM Parameters from an Existing URL

var parser = new UTMParser();
var parsedUtm = parser.Parse("https://example.com/?utm_source=google&utm_medium=cpc&utm_campaign=spring_sale&utm_term=running+shoes&utm_content=banner_ad");

Console.WriteLine(parsedUtm.Source); // Output: google
Console.WriteLine(parsedUtm.Medium); // Output: cpc

3. Building a URL with Individual Parameters

var builder = new UTMBuilder();
var resultUri = builder.Build(
    new Uri("https://example.com"),
    source: "facebook",
    medium: "social",
    campaign: "summer_discount",
    term: "discount code",
    content: "promo_link"
);

Console.WriteLine(resultUri);
// Output: https://example.com/?utm_source=facebook&utm_medium=social&utm_campaign=summer_discount&utm_term=discount+code&utm_content=promo_link

4. Removing Existing UTM Parameters Before Appending New Ones

var utm = new UrchinTrackingModule
{
    Source = "twitter",
    Medium = "social",
    Campaign = "new_product_launch"
};

var builder = new UTMBuilder();
var resultUri = builder.Build(new Uri("https://example.com/?utm_source=oldsource&utm_medium=oldmedium&utm_campaign=oldcampaign"), utm);

Console.WriteLine(resultUri);
// Output: https://example.com/?utm_source=twitter&utm_medium=social&utm_campaign=new_product_launch
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.
  • .NETStandard 2.1

    • No dependencies.
  • net6.0

    • No dependencies.
  • net8.0

    • No dependencies.

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
1.0.5 242 8/17/2024
1.0.1 217 5/11/2024