Closed ahmic closed 3 years ago
Hi @mattstauffer, would appreciate if you can take a look at PR. I'm available to make improvements if necessary..
@ahmic Taking a look now! :) Been a busy summer here. :) Thanks for your PR!
@ahmic I took a quick peek and it's not working on a Nova 1. app. Is this panel.fields
something that's only going to work on Nova 2? (I haven't done much addon dev in 2. so I'm not familiar.)
Either way, let's also get some documentation into the readme for how to use it.
Thanks!
@mattstauffer You are right. As per documentation in Nova 1.* tool's metadata is accessible by const issuesRefunds = this.field.issuesRefunds;
In Nova 2.* const issuesRefunds = this.panel.fields[0].issuesRefunds;
If you have a plan to release a new major version this would work. For version 1.* I can make a change
@ahmic I would love it if it works for both versions. I'll see if I can do a quick modification that makes it work on my 1.* app.
OK, I have it running in 1.*. A problems right now:
This error is formatted wrong. Is this how it looks in 2., or do we need to format the error differently in 1. vs 2.*?
I think I'm also having trouble with the data because the path that I'm testing is getting zero results back, but it shows up as my top result in the "GA most-visited pages this week." I'm suspicious that this is because my account has multiple domains that it tracks, but I'm not entirely sure.
You can see this result here:
The URL for that one is /index.php?page=yahtzee
, but when I pass that path into this tool:
class User
{
public function fields()
{
return [
\Tightenco\NovaGoogleAnalytics\StatsPerPage::make()->path('/index.php?action=yahtzee'),
];
}
}
I get no data:
Also, changing the timeline doesn't change anything. Because, again, I haven't worked with these things in quite a while, I'm curious if it's because I'm doing it wrong (let's get some documentation into this PR!) or whether there's a bug or whether it's because it's Nova 1.*.
I have been working on this today, using Laravel 5.7 with Nova 1.2.0 and Laravel 5.8 with Nova 2.0.11, and here is the update:
field.path
is available. Everything the same
It's working now but there is a minor layout issue. In Nova 1 resource tool title is shown by default, and complete tool component is wrapped inside a card by default. I can the hide title but I think is not a big deal?
To continue working on this @mattstauffer please test again in the same environment like before. If you get zero results again maybe it's related to Google Analytics account setup..
Almost there! It's now rendering correctly, but the dropdown ranges aren't working correctly.
It's possible these are bugs in Nova but I think it's more likely something that changed between Nova 1 and 2?
As you can see, the selected range key is getting passed in correctly; as is the value for the range entry. Not sure what's going on here, honestly
@mattstauffer Really strange. I'm currently testing with Nova v1.2.0 and it's working, no errors. Which version do you have?
v1.3.2. I'll see if I can find one on 1.2.0 later.
Can you show me the actual, specific implementation you have of where you pulled this in and on what sort of resource?
Just pulled Nova v1.3.2 and still working, without any errors. Regarding my setup for Nova v1.* it's a demo app I created to test this since I first made it on Nova v2. I'm using it on the default user resource, path is hardcoded form one of my production apps. Nothing special there..
Can you share the full User resource then? I feel like there might be a different implementation detail here OR it might be something that I have cached since this is a very old Nova install that I've slowly upgraded. I'll try to do it on a fresh Nova install at 1.3.2 a bit later.
// app/Nova/User.php
public function fields(Request $request)
{
return [
\Tightenco\NovaGoogleAnalytics\StatsPerPage::make()
->path('/vijesti/1373/lejla-omerovic-kada-jednom-krocite-u-it-svijet-samo-nebo-je-granica'),
ID::make()->sortable(),
// ...
];
}
Gahh.. I cannot figure out what it is. I just wiped the vendor dir, composer updated, re ran npm dev on both the plugin and my site... cannot reproduce yours working.
Resource tool for showing pageviews for a single resource on detail screen
Single Resource analytics
Pageviews data for single page (Nova resource) shown on detail screen for particular resource
Usage
To enable stats for a specific model, you'll need to add the tool to that model's Nova resource. Make sure to specify the class name so the resource tool can load it properly.
Replace
_PATH_
with appropriate path for your model