It covers Google Analytics Reporting API v4 by sending custom variables
####Nuget Install-Package GoogleAnalyticsReportingAPIWrapper
Javascript, send example data
ga('send', 'event', [eventCategory], [eventAction], [eventLabel], [eventValue], [fieldsObject]);
ga('send', {
hitType: 'event',
eventCategory: 'Product',
eventAction: 'click',
eventLabel: 'ProductId'
});
for more info how to send events to Google Analytics click here
to find which dimensions & metrics you need to pass as parameter, please click here
using System;
using Google.Apis.AnalyticsReporting.v4.Data;
using Report = GoogleAnalyticsReportingAPIWrapper.Report;
namespace WrapperConsole
{
internal class Program
{
private static void Main(string[] args)
{
Report report = new Report();
GetReportsResponse response = report.Get(DateTime.UtcNow.AddDays(-1).ToString("yyyy-MM-dd"),
DateTime.UtcNow.ToString("yyyy-MM-dd"), new[] {"ga:eventValue"},
new[] {"ga:eventCategory, ga:eventAction, ga:eventLabel"}, "[yourViewId]",
"[json file generated by Google API console]",
new[] {"https://www.googleapis.com/auth/analytics.readonly"}, "Wrapper app");
}
}
}