CustomerIOSharp 1.0.0.26
dotnet add package CustomerIOSharp --version 1.0.0.26
NuGet\Install-Package CustomerIOSharp -Version 1.0.0.26
<PackageReference Include="CustomerIOSharp" Version="1.0.0.26" />
paket add CustomerIOSharp --version 1.0.0.26
#r "nuget: CustomerIOSharp, 1.0.0.26"
// Install CustomerIOSharp as a Cake Addin #addin nuget:?package=CustomerIOSharp&version=1.0.0.26 // Install CustomerIOSharp as a Cake Tool #tool nuget:?package=CustomerIOSharp&version=1.0.0.26
Customer.io API C# implementation
Implementation of Customer.io's write-only API for .NET.
Installation
Using Nuget:
Install-Package CustomerIOSharp
Usage
We recommend you implement the ICustomerFactory
interface yourself. Here is a suggested implementation used in one of my projects:
public class CustomerFactory : ICustomerFactory
{
public ICustomerDetails GetCustomerDetails()
{
var user = MembershipHelper.GetCurrentUser();
return user == null
? null
: user.AsCustomer();
}
public string GetCustomerId()
{
var user = MembershipHelper.GetCurrentUser();
return user == null
? null
: user.UserId.ToString();
}
}
Then instantiate CustomerIo
and call IdentifyAsync()
:
var customerIo = new CustomerIo(
"siteid",
"apikey",
new CustomerFactory());
await customerIo.IdentifyAsync();
You should most likely only call IdentifyAsync()
whenever the user logs in or is changed.
If you do not want to implement ICustomerFactory
, you can simply provide the required details to each call:
await customerIo.IdentifyAsync(User.AsCustomer());
Whatever you do, you will have to provide customer data implementing ICustomerDetails
. It has only two required properties, but any properties you supply in your implementation will be forwarded to customer.io:
public class Customer : ICustomerDetails
{
// these two fields are required:
public string Id { get; set; }
public string Email { get; set; }
// these are my custom fields:
public string FirstName { get; set; }
public string LastName { get; set; }
}
Custom events
Track a custom event by calling TrackEvent()
. It takes an event name as the first parameter, the second parameter is any serializable object. Note that it automatically posts using the correct customer (using ICustomerFactory
), but you can also supply your own.
await customerIo.TrackEventAsync("signup", new {
UserGroup = "trial",
Referrer = "email campaign"
});
// this event has no data and uses a different customer
await customerIo.TrackEventAsync("signup", customerId: "foo");
Note that these two variables will be camelcased before being sent to customer.io, so userGroup
and referrer
will be available in your transactional campaigns.
License
Dual licensed under the MIT and the GPL license.
You don’t have to do anything special to choose one license or the other and you don’t have to notify anyone which license you are using.
MIT license
The MIT License (MIT)
Copyright (c) 2013-2017 Digital Creations AS.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
GPL license
Copyright (c) 2013-2017 Digital Creations AS.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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 | netcoreapp1.0 was computed. netcoreapp1.1 was computed. netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard1.1 is compatible. netstandard1.2 was computed. netstandard1.3 was computed. netstandard1.4 was computed. netstandard1.5 was computed. netstandard1.6 was computed. netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net45 was computed. net451 was computed. net452 was computed. net46 was computed. 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 | tizen30 was computed. tizen40 was computed. tizen60 was computed. |
Universal Windows Platform | uap was computed. uap10.0 was computed. |
Windows Phone | wpa81 was computed. |
Windows Store | netcore was computed. netcore45 was computed. netcore451 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 1.1
- NETStandard.Library (>= 1.6.1)
- Newtonsoft.Json (>= 10.0.3)
-
.NETStandard 2.0
- Newtonsoft.Json (>= 10.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Removes dependency on FubarCoder.RestSharp.Portable, and is now multi-targeting netstandard1.1 and netstandard2.0