-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow to send a goal on a full cached page
- Loading branch information
Showing
17 changed files
with
219 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
/** | ||
* Copyright (C) 2024 Pixel Développement | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace PixelOpen\Plausible\Plugin; | ||
|
||
use Magento\Catalog\Controller\Category\View; | ||
use Magento\Framework\Controller\ResultInterface; | ||
use PixelOpen\Plausible\Helper\Config; | ||
use PixelOpen\Plausible\Session\Goals; | ||
|
||
class GoalCategory | ||
{ | ||
protected Goals $goals; | ||
|
||
public function __construct( | ||
Goals $goals | ||
) { | ||
$this->goals = $goals; | ||
} | ||
|
||
/** | ||
* Add goal when customer visits a category | ||
*/ | ||
public function afterExecute(View $subject, ResultInterface $result): ResultInterface | ||
{ | ||
$this->goals->add(Config::PLAUSIBLE_GOAL_CATEGORY); | ||
|
||
return $result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
/** | ||
* Copyright (C) 2024 Pixel Développement | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace PixelOpen\Plausible\Plugin; | ||
|
||
use Magento\Customer\Controller\Ajax\Login; | ||
use Magento\Framework\Controller\ResultInterface; | ||
use PixelOpen\Plausible\Helper\Config; | ||
use PixelOpen\Plausible\Session\Goals; | ||
|
||
class GoalLoginAjax | ||
{ | ||
protected Goals $goals; | ||
|
||
public function __construct( | ||
Goals $goals | ||
) { | ||
$this->goals = $goals; | ||
} | ||
|
||
/** | ||
* Add goal after customer was connected | ||
*/ | ||
public function afterExecute(Login $subject, ResultInterface $result): ResultInterface | ||
{ | ||
$this->goals->add(Config::PLAUSIBLE_GOAL_LOGIN); | ||
|
||
return $result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
/** | ||
* Copyright (C) 2024 Pixel Développement | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace PixelOpen\Plausible\Plugin; | ||
|
||
use Magento\Catalog\Controller\Product\View; | ||
use Magento\Framework\Controller\ResultInterface; | ||
use PixelOpen\Plausible\Helper\Config; | ||
use PixelOpen\Plausible\Session\Goals; | ||
|
||
class GoalProduct | ||
{ | ||
protected Goals $goals; | ||
|
||
public function __construct( | ||
Goals $goals | ||
) { | ||
$this->goals = $goals; | ||
} | ||
|
||
/** | ||
* Add goal when customer visits a product page | ||
*/ | ||
public function afterExecute(View $subject, ResultInterface $result): ResultInterface | ||
{ | ||
$this->goals->add(Config::PLAUSIBLE_GOAL_PRODUCT); | ||
|
||
return $result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
/** | ||
* Copyright (C) 2024 Pixel Développement | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
--> | ||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> | ||
<body> | ||
<referenceBlock name="pixel_open_plausible_goals"> | ||
<block name="pixel_open_plausible_goals_fpc" class="PixelOpen\Plausible\Block\Goals" template="PixelOpen_Plausible::luma/goals/fpc.phtml" /> | ||
</referenceBlock> | ||
</body> | ||
</page> |
Oops, something went wrong.