Skip to content
This repository was archived by the owner on Jan 2, 2024. It is now read-only.

Commit 711222c

Browse files
committed
Refactor
1 parent e61c22e commit 711222c

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ GOOGLE_ANALYTICS_TRACKING_ID=UA-01234567-89
4343

4444
This package comes with a `@sendAnalyticsClientId` directive that stores the `Client ID` from the GA front-end to your Laravel backend.
4545

46-
It uses the [Axios HTTP library](https://github.com/axios/axios) the make an asynchronous POST request. Axios was choosen as it is provided by default in Laravel in the `resources/js/bootstrap.js` file.
46+
It uses the [Axios HTTP library](https://github.com/axios/axios) the make an asynchronous POST request. Axios was choosen because it is provided by default in Laravel in the `resources/js/bootstrap.js` file.
4747

4848
Add the directive somewhere after initializing/configuring GA. The POST request will only be made if the `Client ID` isn't stored yet or when it's refreshed.
4949

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ga(function () {
22
var clientId = ga.getAll()[0].get('clientId');
33

4-
if(clientId != @json(app('analytics-event-tracking-client-id'))) {
4+
if(clientId != @json(app('analytics-event-tracking.client-id'))) {
55
window.axios.post('/gaid', { id: clientId });
66
}
77
}

src/ServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ private function registerClientId()
6262
{
6363
$this->app->singleton(ClientIdRepostory::class, ClientIdSession::class);
6464

65-
$this->app->bind('analytics-event-tracking-client-id', function () {
65+
$this->app->bind('analytics-event-tracking.client-id', function () {
6666
return $this->app->make(ClientIdSession::class)->get();
6767
});
6868

tests/Http/BladeDirectiveTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public function it_has_a_blade_directive_that_compares_the_current_client_id_to_
1515
View::addLocation(__DIR__);
1616

1717
$this->assertStringContainsString(
18-
app('analytics-event-tracking-client-id'),
18+
app('analytics-event-tracking.client-id'),
1919
view('javascriptView')->render()
2020
);
2121
}

tests/Http/ClientIdSessionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function it_stores_the_client_id_by_the_given_key()
1616

1717
$this->assertEquals('1337', session('someKey'));
1818
$this->assertEquals('1337', $clientIdSession->get());
19-
$this->assertEquals('1337', app('analytics-event-tracking-client-id'));
19+
$this->assertEquals('1337', app('analytics-event-tracking.client-id'));
2020
}
2121

2222
/** @test */

0 commit comments

Comments
 (0)