bnomei / kirby3-pageviewcounter

Track Page view count and last visited timestamp
https://forum.getkirby.com/t/kirby3-pageview-counter-track-page-view-count-and-last-visited-timestamp/23582
MIT License
22 stars 0 forks source link

More Details #3

Closed alFlash closed 3 years ago

alFlash commented 3 years ago

Hi, is it possible to provide a little bit more details to setup the plugin?

I copied the plugin files to the plugin folder I configured the config.php to file to use the page fields return [ 'bnomei.pageviewcounter.field.count' => 'viewcount', 'bnomei.pageviewcounter.field.timestamp' => 'lastvisited', 'bnomei.pageviewcounter.counter' => function () { return new \Bnomei\PageViewCounterField(); },

I wrote the tracking image code in my footer snippet.

What I have to do in my blueprints to see the viewcount and the lastvisited field in the panel?

Sry for my bad English. Thank You!

bnomei commented 3 years ago

they are just plain kirby text or hidden fields. i usually have blueprints for them and extend them in my target pages blueprints. like this...

site/blueprints/fields/viewcount.yml

type: number
min: 0
default: 0
disabled: true
label: Visit Count

site/blueprints/fields/lastvisited.yml

type: hidden

in your page blueprint

fields:
  viewcount:
    extends: fields/viewcount
  lastvisited:
    extends: fields/lastvisited
alFlash commented 3 years ago

Thank You!