Category : google-analytics

hello I’m making two requests on google analitys and i would like to get id transaction of the lines that had transactions exemplo return: [ "source" => "google" "medium" => "cpc" "adwordsCampaignID" => "11297081171" "adContent" => "(not set)" "adwordsCreativeID" => "471314201447" "sessions" => "1266" "bounceRate" => "71.24802527646129" "avgSessionDuration" => "30.337282780410742" "pageviewsPerSession" => "1.24565560821485" "goalConversionRateAll" => ..

Read more

strong textI am getting different google api results when running this function on locally in comparison to my server. public static function debug(){ $date = Carbon::now(‘Europe/Berlin’); $date->setISODate(2021,25); $start = $date->copy()->startOfWeek(); $end = $date->copy()->endOfWeek(); $ga= Analytics::performQuery( Period::create($start , $end), ‘ga:pageviews’, [ ‘metrics’ => ‘ga:pageviews’, ‘dimensions’ => ‘ga:date’, ‘filters’ => ‘ga:pagePath=~/page1*,ga:pagePath=~/page2*,ga:pagePath=~/page3*,ga:pagePath=~/page34,ga:pagePath=~/page5*’ ] ); return $ga; } Results ..

Read more

I am using this library : https://github.com/spatie/laravel-analytics I am trying to figure out how to do a User Activity request as documented here: https://developers.google.com/analytics/devguides/reporting/core/v4/user-reporting. I know that you can make custom reports with laravel analytics with ‘Analytics::perfomQuery’. I cant seem to find the right metrics and dimensions to get the request right. I have tried ..

Read more

I am currently getting my data like this: $result = Analytics::performQuery( Period::days(7), ‘ga:pageviews’, [ ‘dimensions’ => ‘ga:pagePath’, ‘max-results’ => $maxResults, ‘sort’ => ‘-ga:pageviews’, ‘filters’ => ‘ga:pagePath=~/blog*’ ] ); The response delivers multiple pages with the same slug like: /blogs/article1 /blogs/article1?ref=homepage and so on. In order to get all the pageviews i currently explode the url ..

Read more

I have a new url that is a few days old. yet when i increse the time to Period:days(40) (any time works) the pageviews increase. $maxResults = 10; $myQuery= Analytics::performQuery( Period::days(20), ‘ga:pageViews’, [ ‘dimensions’ => ‘ga:pagePath,ga:pageTitle’, ‘metrics’ => ‘ga:pageviews’, ‘sort’ => ‘-ga:pageviews’, ‘max-results’ => $maxResults, ‘filters’ => ‘ga:pagePath=~/blog/’ ] ); Results look like this: 0: ..

Read more

I’m using Laravel Analytics to get data of the visitors of my application. In my Google Analytics dashboard, every page have it own visits numbers, unique visitors, countries of visitors etc .. like in this image : In my web.php, I’m creating a route to test the package : Route::get(‘/data’, function () { $analyticsData = ..

Read more

I am trying to implement gtag.js in my website to track enhance e-commerce data in google analytics. All event is firing in the realtime section of google analytics but no data showing in e-commerce section. Please help me. <script> var quantity = "<?php echo $value->product_quantity; ?>"; items.push({ "id":"<?php echo $value->product_code; ?>", "name":"<?php echo $value->name; ?>", ..

Read more

im trying to add google analytics to my page. I have created analytics.blade.php with code like this: <script> (function(i,s,o,g,r,a,m){i[‘GoogleAnalyticsObject’]=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,’script’,’https://www.google-analytics.com/analytics.js’,’ga’); ga(‘create’, ‘Analytics_ID’, ‘auto’); ga(‘send’, ‘pageview’); </script> and added @include (‘analytics’) to app.blade.php But i cant get any info in google analytics of that page. Maybe i have something more to do, or ..

Read more

I have been successfully running a runRealtimeReport function from Google Analytics Data API, but I am currently struggling to run a runReport function. Here is my code which I try to use: $client->runReport([ ‘entity’ => [‘property_Id’ => config(‘app.ga.propertyID’)], ‘dateRanges’ => [new DateRange([‘startDate’ => ’28daysago’]), new DateRange([‘endDate’ => ‘today’])], ‘dimensions’ => [new Dimension([ ‘name’ => ‘sessionSource’ ..

Read more

I have a URL for my categories like this : example.com/shop/category1 And this is code in my web.php : Route::any(‘shop/{slug}’, ‘[email protected]’)->name(‘category’); And I have many other routes for products, articles Etc. But when I analyze my website, I have this shop in all routes like this : example.com/products/shop example.com/articles/shop example.com/shop/shop Other routes works fine, I ..

Read more

I’m trying to implement this code // These keys are the same as the config file $analyticsConfig = [ ‘view_id’ => env(‘ANALYTICS_VIEW_ID’), ‘service_account_credentials_json’ => storage_path(‘app/analytics/service-account-credentials.json’), ‘cache_lifetime_in_minutes’ => 60 * 24, ‘cache’ => [ ‘store’ => ‘file’, ], ]; $client AnalyticsClientFactory::createForConfig($analyticsConfig); $analytics = new Analytics($client, $config[‘view_id’]); // Use $analytics to get analytics ? But I got ..

Read more

I tried to retrieve all information about my website from GA (Google Analytics). I’m using laravel and this package https://github.com/spatie/laravel-analytics to make my life easier. However, that package requires "View ID" from GA, which I can’t help myself to find it. I read this thread https://support.google.com/analytics/thread/15684521?hl=en and I’m guessing that since GA 4 they totally ..

Read more

I tried to retrieve all information about my website from GA (Google Analytics). I’m using laravel and this package https://github.com/spatie/laravel-analytics to make my life easier. However, that package requires "View ID" from GA, which I can’t help myself to find it. I read this thread https://support.google.com/analytics/thread/15684521?hl=en and I’m guessing that since GA 4 they totally ..

Read more