PHP code example of phbergsmann / behat-google-analytics-extension

1. Go to this page and download the library: Download phbergsmann/behat-google-analytics-extension 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/ */

    

phbergsmann / behat-google-analytics-extension example snippets


    /**
     * Initializes context.
     * Every scenario gets it's own context object.
     *
     * @param array $parameters context parameters (set them up through behat.yml)
     */
    public function __construct(array $parameters)
    {
		  $this->useContext('googleanalytics', new PhBergsmann\BehatGoogleAnalyticsExtension\Behat\Context\GoogleAnalyticsContext());
    }

	/**
	* Opens specified page.
	*
	* @Override Given /^(?:|I )am on "(?P<page>[^"]+)"$/
	* @Override When /^(?:|I )go to "(?P<page>[^"]+)"$/
	*/
	public function visit($page)
	{
		$this->getSubcontext('test')->visit($page);
	}