PHP code example of xruff / googleanalytics

1. Go to this page and download the library: Download xruff/googleanalytics 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/ */

    

xruff / googleanalytics example snippets


use XRuff\App\UI\Components\IGoogleAnalyticsControlFactory;

abstract class BasePresenter extends Nette\Application\UI\Presenter
{
	/** @var IGoogleAnalyticsControlFactory $googleAnalyticsControlFactory @inject */
	public $googleAnalyticsControlFactory;

	protected function createComponentGoogleAnalytics()
	{
		return $this->googleAnalyticsControlFactory->create();
	}
}
smarty
    ...
</head>
<body>
    {control googleAnalytics 'UA-123456789-2', false}
    ...