Skip to content

Commit 04187ce

Browse files
committed
added posthog anlytics service
1 parent 7dc33ef commit 04187ce

File tree

9 files changed

+105
-5
lines changed

9 files changed

+105
-5
lines changed

phpstan-baseline.neon

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,3 @@ parameters:
66
count: 1
77
path: src/CookieSolution.php
88

9-
-
10-
message: '#^Parameter \#1 \$view of function view expects view\-string\|null, string given\.$#'
11-
identifier: argument.type
12-
count: 1
13-
path: src/CookieSolution.php

resources/lang/de/services.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@
4444
'paypal' => [
4545
'description' => 'PayPal ist ein Zahlungsdienst, der es uns ermöglicht, Zahlungen von unseren Kunden anzunehmen. PayPal kann persönliche Informationen wie Namen, E-Mail-Adressen und Rechnungsinformationen sammeln.',
4646
],
47+
'posthog_analytics' => [
48+
'description' => 'PostHog Analytics ist ein Statistikdienst, der es uns ermöglicht, Daten über die Nutzung unserer Website zu sammeln, um deren Funktionalität zu verbessern. PostHog kann personenbezogene Daten wie Namen, E-Mail-Adressen und Navigationsdaten erfassen.',
49+
'cookies' => [
50+
'ph_phc_*' => 'Wird verwendet, um Informationen über das Nutzerverhalten zu erhalten',
51+
],
52+
],
4753
'scalapay' => [
4854
'description' => 'Scalapay ist ein Zahlungsdienst, der es uns ermöglicht, Ratenzahlungen von unseren Kunden anzunehmen. Scalapay kann persönliche Informationen wie Namen, E-Mail-Adressen und Rechnungsinformationen sammeln, um die Eignung des Benutzers für seine Zahlungsmethoden zu bewerten und diese Zahlungsmethoden zu personalisieren.',
4955
],

resources/lang/en/services.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@
4444
'paypal' => [
4545
'description' => 'PayPal is a payment service that allows us to accept payments from our customers. PayPal may collect personal information such as names, email addresses, and billing information.',
4646
],
47+
'posthog_analytics' => [
48+
'description' => 'PostHog analytics is a statistics service that allows us to collect data about the usage of our website to improve its functionality. PostHog may collect personal information such as names, email addresses, and browsing data.',
49+
'cookies' => [
50+
'ph_phc_*' => 'Used to obtain information about user behavior',
51+
],
52+
],
4753
'scalapay' => [
4854
'description' => 'Scalapay is a payment service that allows us to accept installment payments from our customers. Scalapay may collect personal information such as names, email addresses, and billing information in order to evaluate the user\'s suitability for its payment methods and personalize those payment methods.',
4955
],

resources/lang/es/services.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@
4444
'paypal' => [
4545
'description' => 'PayPal es un servicio de pago que nos permite aceptar pagos de nuestros clientes. PayPal puede recopilar información personal como nombres, direcciones de correo electrónico e información de facturación.',
4646
],
47+
'posthog_analytics' => [
48+
'description' => 'PostHog Analytics es un servicio de estadísticas que nos permite recopilar datos sobre el uso de nuestro sitio web para mejorar su funcionamiento. PostHog puede recopilar información personal como nombres, direcciones de correo electrónico y datos de navegación.',
49+
'cookies' => [
50+
'ph_phc_*' => 'Se utiliza para obtener información sobre el comportamiento del usuario',
51+
],
52+
],
4753
'scalapay' => [
4854
'description' => 'Scalapay es un servicio de pago que nos permite aceptar pagos a plazos de nuestros clientes. Scalapay puede recopilar información personal como nombres, direcciones de correo electrónico e información de facturación para evaluar la idoneidad del usuario para sus métodos de pago y personalizar esos métodos de pago.',
4955
],

resources/lang/fr/services.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@
4444
'paypal' => [
4545
'description' => 'PayPal est un service de paiement qui nous permet d\'accepter des paiements de nos clients. PayPal peut collecter des informations personnelles telles que des noms, des adresses électroniques et des informations de facturation.',
4646
],
47+
'posthog_analytics' => [
48+
'description' => 'PostHog analytics est un service de statistiques qui nous permet de collecter des données sur l’utilisation de notre site web afin d’en améliorer le fonctionnement. PostHog peut recueillir des informations personnelles telles que les noms, adresses e-mail et données de navigation.',
49+
'cookies' => [
50+
'ph_phc_*' => 'Utilisé pour obtenir des informations sur le comportement des utilisateurs',
51+
],
52+
],
4753
'scalapay' => [
4854
'description' => 'Scalapay est un service de paiement qui nous permet d\'accepter des paiements échelonnés de nos clients. Scalapay peut collecter des informations personnelles telles que des noms, des adresses électroniques et des informations de facturation afin d\'évaluer l\'adéquation de l\'utilisateur à ses méthodes de paiement et de personnaliser ces méthodes de paiement.',
4955
],

resources/lang/it/services.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@
4444
'paypal' => [
4545
'description' => 'PayPal è un servizio di pagamento che ci consente di accettare pagamenti dai nostri clienti. PayPal potrebbe raccogliere informazioni personali come nomi, indirizzi e-mail e informazioni di fatturazione.',
4646
],
47+
'posthog_analytics' => [
48+
'description' => 'PostHog analytics è un servizio di statistica che ci consente di raccogliere dati sull\'utilizzo del nostro sito web per migliorarne il funzionamento. PostHog potrebbe raccogliere informazioni personali come nomi, indirizzi e-mail e dati di navigazione.',
49+
'cookies' => [
50+
'ph_phc_*' => 'Utilizzato per ottenere informazioni sul comportamento degli utenti',
51+
],
52+
],
4753
'scalapay' => [
4854
'description' => 'Scalapay è un servizio di pagamento che ci consente di accettare pagamenti a rate dai nostri clienti. Scalapay potrebbe raccogliere informazioni personali come nomi, indirizzi e-mail e informazioni di fatturazione per valutare l\'idoneità dell\'utente ai suoi metodi di pagamento e personalizzare tali metodi di pagamento.',
4955
],
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
namespace Keepsuit\CookieSolution\ServiceFactories\PostHog;
4+
5+
use Keepsuit\CookieSolution\Cookie;
6+
use Keepsuit\CookieSolution\CookiePurpose;
7+
use Keepsuit\CookieSolution\Service;
8+
use Keepsuit\CookieSolution\ServiceFactories\ServiceFactory;
9+
10+
class PostHogAnalyticsServiceFactory extends ServiceFactory
11+
{
12+
protected PostHogDataProcessingLocation $location = PostHogDataProcessingLocation::USA;
13+
14+
protected int $cookieDurationInDays = 365;
15+
16+
public function location(PostHogDataProcessingLocation $location): static
17+
{
18+
$this->location = $location;
19+
20+
return $this;
21+
}
22+
23+
public function cookieDuration(int $days): static
24+
{
25+
$this->cookieDurationInDays = $days;
26+
27+
return $this;
28+
}
29+
30+
public function build(): Service
31+
{
32+
return new Service(
33+
name: 'PostHog Analytics',
34+
provider: $this->location->provider(),
35+
description: __('cookie-solution::services.posthog_analytics.description'),
36+
privacyPolicyUrl: 'https://posthog.com/privacy',
37+
dataProcessingLocation: $this->location->country(),
38+
cookies: [
39+
new Cookie(
40+
name: 'ph_phc_*',
41+
purpose: CookiePurpose::STATISTICS,
42+
duration: $this->cookieDurationInDays,
43+
description: __('cookie-solution::services.posthog_analytics.cookies.ph_phc_*'),
44+
),
45+
]
46+
);
47+
}
48+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
namespace Keepsuit\CookieSolution\ServiceFactories\PostHog;
4+
5+
use Symfony\Component\Intl\Countries;
6+
7+
enum PostHogDataProcessingLocation
8+
{
9+
case USA;
10+
case EUROPE;
11+
12+
public function provider(): string
13+
{
14+
return 'PostHog Inc.';
15+
}
16+
17+
public function country(): string
18+
{
19+
return match ($this) {
20+
self::USA => Countries::getName('US', app()->getLocale()),
21+
self::EUROPE => Countries::getName('DE', app()->getLocale())
22+
};
23+
}
24+
}

workbench/app/Providers/WorkbenchServiceProvider.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
use Keepsuit\CookieSolution\ServiceFactories\Meta\FacebookPixelServiceFactory;
1919
use Keepsuit\CookieSolution\ServiceFactories\Meta\MetaDataProcessingLocation;
2020
use Keepsuit\CookieSolution\ServiceFactories\PayPal\PayPalServiceFactory;
21+
use Keepsuit\CookieSolution\ServiceFactories\PostHog\PostHogAnalyticsServiceFactory;
22+
use Keepsuit\CookieSolution\ServiceFactories\PostHog\PostHogDataProcessingLocation;
2123
use Keepsuit\CookieSolution\ServiceFactories\Scalapay\ScalapayServiceFactory;
2224
use Keepsuit\CookieSolution\ServiceFactories\Stripe\StripeServiceFactory;
2325
use Keepsuit\CookieSolution\ServiceFactories\Zoho\ZohoCampaignsServiceFactory;
@@ -39,6 +41,7 @@ public function register(): void
3941
->register(MailchimpServiceFactory::new()->build())
4042
->register(FacebookPixelServiceFactory::new()->location(MetaDataProcessingLocation::IRELAND)->build())
4143
->register(PayPalServiceFactory::new()->build())
44+
->register(PostHogAnalyticsServiceFactory::new()->location(PostHogDataProcessingLocation::EUROPE)->build())
4245
->register(ScalapayServiceFactory::new()->build())
4346
->register(StripeServiceFactory::new()->build())
4447
->register(ZohoCampaignsServiceFactory::new()->location(ZohoDataProcessingLocation::NEDERLAND)->build());

0 commit comments

Comments
 (0)