diff --git a/app/Http/Controllers/ProductsCompareController.php b/app/Http/Controllers/ProductsCompareController.php index 897ac17..3cdb658 100644 --- a/app/Http/Controllers/ProductsCompareController.php +++ b/app/Http/Controllers/ProductsCompareController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers; +use Alfrasc\MatomoTracker\Facades\LaravelMatomoTracker; use Illuminate\Http\Request; use App\Models\IkeaProducts; use Illuminate\Http\Client\Pool; @@ -27,7 +28,12 @@ class ProductsCompareController extends Controller $text = $request->input("text"); $country = $request->input("country"); - Log::channel('db')->info("{codes} {countries} {country} {online} {text} {ip} {referer}", ["codes" => $codes, "countries" => $countries, "country" => $country, "online" => $online, "text" => $text, "ip" => $request->ip(), "referer" => $request->headers->get('referer')]); + $vars = ["codes" => $codes, "countries" => $countries, "country" => $country, "online" => $online, "text" => $text, "ip" => $request->ip(), "referer" => $request->headers->get('referer')]; + + Log::channel('db')->info("{codes} {countries} {country} {online} {text} {ip} {referer}", $vars ); + LaravelMatomoTracker::doTrackAction('compare', $text); + + $codes = collect($codes); $countries = collect($countries); diff --git a/composer.json b/composer.json index 3b96efa..03a7dbf 100644 --- a/composer.json +++ b/composer.json @@ -17,6 +17,7 @@ "laravel/sanctum": "^2.14.1", "laravel/tinker": "^2.7", "masterminds/html5": "^2.8", + "matomo/matomo-php-tracker": "^3.2", "paquettg/php-html-parser": "^2.2", "pusher/pusher-php-server": "^7.0", "spatie/laravel-permission": "^5.5", diff --git a/composer.lock b/composer.lock index 951777e..316e0ce 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "932b0270f36b70f4585461c8c5e49167", + "content-hash": "38ea7f8106608bed752012bfa0ee857d", "packages": [ { "name": "alfrasc/laravel-matomo-tracker", diff --git a/config/matomotracker.php b/config/matomotracker.php index 929ed3e..1a309dd 100644 --- a/config/matomotracker.php +++ b/config/matomotracker.php @@ -15,7 +15,7 @@ return [ /** * The auth token of your user */ - 'tokenAuth' => env('MATOMO_AUTH_TOKEN', ''), + 'tokenAuth' => env('MATOMO_AUTH_TOKEN', '3a58110f13366a6438f86a17bf6d2d4c'), /** * For queuing the tracking you can use custom queue names. Use 'default' if you want to run the queued items within the standard queue. diff --git a/lang/id.json b/lang/id.json index f99c5bc..20823e1 100644 --- a/lang/id.json +++ b/lang/id.json @@ -139,5 +139,6 @@ "error: ziggy error: route 'products.count' is not in the route list.": "Error: Ziggy error: route 'products.count' is not in the route list.", "doc": "Doc", "firefox 125": "Firefox 125", - "logs": "Logs" + "logs": "Logs", + "typeerror: $matomo.trackevent is not a function": "TypeError: $matomo.trackEvent is not a function" } \ No newline at end of file diff --git a/package.json b/package.json index 0ffbebe..f7c8f71 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "vue": "3.3.x", "vue-google-charts": "^1.1.0", "vue-json-pretty": "^2.4.0", + "vue-matomo": "^4.2.0", "vue-multiselect": "^3.0.0-beta.3", "vue3-easy-data-table": "^1.5.47", "vue3-multiselect-checkboxed": "^0.0.9", diff --git a/resources/js/Pages/IkeaRoot.vue b/resources/js/Pages/IkeaRoot.vue index 8406b1f..15bae1c 100644 --- a/resources/js/Pages/IkeaRoot.vue +++ b/resources/js/Pages/IkeaRoot.vue @@ -28,6 +28,7 @@ const screenHeight = ref(screen.height) const hover = ref(true); const hoverImage = ref(null); const selectedRow = ref(null); +// const $matomo = inject('$matomo'); const sdropdown = ref([ { text: "Description", value: "typeName" }, @@ -407,6 +408,7 @@ const showRow = async (item) => { country: settingsStore.country.code, }); + console.log('MATOMO',$matomo); products.value = response.data.products; countryHash.value = response.data.countryHash; console.log("TEST=", response.data); diff --git a/resources/js/app.js b/resources/js/app.js index 7a4c2b2..dd3d3b3 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -11,6 +11,7 @@ import Swal from 'sweetalert2'; import { Inertia } from '@inertiajs/inertia'; import axios from 'axios'; import * as commons from './common.js' +// import VueMatomo from 'vue-matomo'; const appName = window.document.getElementsByTagName('title')[0]?.innerText || 'Laravel'; @@ -30,13 +31,20 @@ createInertiaApp({ return createApp({ render: () => h(app, props) }) .use(plugin) .use(ZiggyVue, Ziggy) + // .use(VueMatomo, { + // // Configure your matomo server and site by providing + // host: 'https://matomo.soson.eu', + // siteId: 3, + // }) .mixin({ methods: { ...commons, themes: () => Themes, }, }) - .mount(el); + // .provide('$matomo', VueMatomo) + .mount(el) + }, }); diff --git a/resources/views/app.blade.php b/resources/views/app.blade.php index 70dc8ab..9f55634 100644 --- a/resources/views/app.blade.php +++ b/resources/views/app.blade.php @@ -26,7 +26,7 @@ @inertiaHead - + --}}