Test matomo tracker

This commit is contained in:
2024-04-01 18:02:39 +02:00
parent c8775f0449
commit 5725307213
9 changed files with 26 additions and 7 deletions

View File

@@ -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);

View File

@@ -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",

2
composer.lock generated
View File

@@ -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",

View File

@@ -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.

View File

@@ -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"
}

View File

@@ -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",

View File

@@ -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);

View File

@@ -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)
},
});

View File

@@ -26,7 +26,7 @@
@inertiaHead
<!-- Matomo -->
<script>
{{-- <script>
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['trackPageView']);
@@ -38,7 +38,7 @@
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
</script>
</script> --}}
<!-- End Matomo Code -->
</head>