PHP code example of octfx / plausible

1. Go to this page and download the library: Download octfx/plausible library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

octfx / plausible example snippets


wfLoadExtension( 'Plausible' );  
$wgPlausibleDomain = "https://plausible.io";  
$wgPlausibleDomainKey = "mywiki.example.com"; // change to your site address
$wgPlausibleApikey = ''; // Only necessary when using Extension:PageViewInfo

# Default Configuration
$wgPlausibleServerSideTracking = [
    // Event Name: pageview
    'pageview' => false,
    // Event Name: 404 
    'page404' => false,
    // Event Name: Page: Edit 
    'pageedit' => true, // Page has been successfully edited
    // Event Name: Page: Delete
    'pagedelete' => true, // Page has been deleted
    // Event Name: Page: Undelete
    'pageundelete' => true, // Page has been undeleted
    // Event Name: Page: Move
    'pagemove' => true, // Page was moved
    // Event Name: User: Register
    'userregister' => false, // A new user registered
    // Event Name: User: Login
    'userlogin' => false, // A user logged in
    // Event Name: User: Logout
    'userlogout' =>  false, // A user logged out
    // Event Name: File: Upload
    'fileupload' => true, // A file was uploaded
    // Event Name: File: Delete
    'filedelete' => true, // A file was deleted
    // Event Name: File: Undelete
    'fileundelete' => true, // A file was undeleted
    // Event Name: Search: Not found
    'searchnotfound' => true, // A searched term was not found / has no title on the wiki
    // Event Name: Search: Found
    'searchfound' => true, // A searched term was found / has a corresponding title on the wiki
];