jGMP

Java library for Google's Measurement Protocol.

Лицензия

Лицензия

Группа

Группа

com.github.tasubo
Идентификатор

Идентификатор

jgmp
Последняя версия

Последняя версия

1.7
Дата

Дата

Тип

Тип

jar
Описание

Описание

jGMP
Java library for Google's Measurement Protocol.
Ссылка на сайт

Ссылка на сайт

https://github.com/tasubo/jgmp.git
Система контроля версий

Система контроля версий

https://github.com/tasubo/jgmp.git

Скачать jgmp

Имя Файла Размер
jgmp-1.7.pom
jgmp-1.7.jar 57 KB
jgmp-1.7-sources.jar 18 KB
jgmp-1.7-javadoc.jar 206 KB
Обзор

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.github.tasubo/jgmp/ -->
<dependency>
    <groupId>com.github.tasubo</groupId>
    <artifactId>jgmp</artifactId>
    <version>1.7</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.tasubo/jgmp/
implementation 'com.github.tasubo:jgmp:1.7'
// https://jarcasting.com/artifacts/com.github.tasubo/jgmp/
implementation ("com.github.tasubo:jgmp:1.7")
'com.github.tasubo:jgmp:jar:1.7'
<dependency org="com.github.tasubo" name="jgmp" rev="1.7">
  <artifact name="jgmp" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.tasubo', module='jgmp', version='1.7')
)
libraryDependencies += "com.github.tasubo" % "jgmp" % "1.7"
[com.github.tasubo/jgmp "1.7"]

Зависимости

test (4)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.11
org.hamcrest : hamcrest-library jar 1.3
org.mutabilitydetector : MutabilityDetector jar 0.9
org.mockito : mockito-core jar 1.9.5

Модули Проекта

Данный проект не имеет модулей.

jGMP

Build Status

Java library for Google's Measurement Protocol

https://developers.google.com/analytics/devguides/collection/protocol/v1/

Supports almost all features. 97% of lines covered by tests.

All builders and payload messages are immutable.

Notice

While aim of this library was to reduce chance of making invalid requests it is still possible to make invalid requests to GA due to not always consistent specs. If you find cases where this is true, please fill an issue and we will address it.

Maven

<dependency>
    <groupId>com.github.tasubo</groupId>
    <artifactId>jgmp</artifactId>
    <version>1.7</version>
</dependency>

Examples

        MpClient mpClient = MpClient.withTrackingId("UA-40659159-1")
                .withCacheBuster()
                .create();

        App app = App.named("jGMP integration test").create();

        ClientID clientID = ClientID.seeded("192.168.0.1", "MyString");

        mpClient.send(AppView.hit("View description").with(app).with(clientId));
        MpClient mpClient = MpClient.withTrackingId("UA-40659159-1")
                .withCacheBuster()
                .create();

        ClientID clientID = ClientID.seeded("my_cookie=789");

        Document document = Document.with()
                .description("long document")
                .hostname("localhost.com")
                .path("/root")
                .title("my document title")
                .create();

        mpClient.send(PageView.hit().with(document).with(clientID));
        MpClient mpClient = MpClient.withTrackingId("UA-40659159-1")
                .withClientId(clientId)
                .withCacheBuster()
                .create();

        App app = App.named("jGMP integration test").create();

        mpClient.send(Event.ofCategory("Test").withAction("testhit").labeled("Integration").create().with(app));
        App app = App.named("jGMP integration test")
                .version("0.1337")
                .create();

        SystemInfo systemInfo = SystemInfo.with()
                .colorBits(24)
                .screenResolution(800, 600)
                .userLanguage("lt_LT")
                .documentEncoding("UTF-8")
                .javaEnabled()
                .create();

        MpClient mpClient = MpClient.withTrackingId("UA-40659159-1")
                .withClientId(clientId)
                .withCacheBuster()
                .using(systemInfo)
                .using(app)
                .create();

        mpClient.send(Timing.pageLoad(23));
        App app = App.named("jGMP integration test")
                .version("0.8008")
                .create();

        MpClient mpClient = MpClient.withTrackingId("UA-40659159-1")
                .withClientId(clientId)
                .withCacheBuster()
                .using(app)
                .create();

        Decorating referrer = Referrer.from("http://localhost/");
        UserTiming userTiming = Timing.user().name("test").time(4).create();

        mpClient.send(userTiming.with(referrer));
        MpClient mpClient = MpClient.withTrackingId("UA-40659159-1")
                .withCacheBuster()
                .noCacheBuster()
                .anonymizingIp()
                .noAnonymizingIp()
                .usePost()
                .useSsl()
                .usePlainHttp()
                .useGet()
                .create();

        App app = App.named("jGMP integration test").create();

        mpClient.send(AppView.hit("View description").with(app));
		// example for asynchronous, non-blocking requests

		int concurrentRequests = 10;

        JavaGetConnectionRequester blockingHttpRequester = 
				new JavaGetConnectionRequester();		
		AsyncHttpRequester asyncHttpRequester = 
				new AsyncHttpRequester(blockingHttpRequester, concurrentRequests);
		
		MpClient asyncMpClient = MpClient.withTrackingId("UA-40659159-1")
				.withClientId(clientId)
				.httpRequester(asyncHttpRequester)
				.create();

        App app = App.named("jGMP integration test").create();

        asyncMpClient.send(AppView.hit("View description").with(app));

		// when your program shuts down you have to shutdown AsyncHttpRequester
		asyncHttpRequester.shutdown();

For more usage examples please see tests

Версии библиотеки

Версия
1.7
1.6
1.5
1.4
1.3
1.2
1.1
1.0