Skip to content

Commit e0ec1b3

Browse files
committed
Refactoring
1 parent d6dfed5 commit e0ec1b3

File tree

4 files changed

+23
-16
lines changed

4 files changed

+23
-16
lines changed

Block/Adminhtml/System/Config/Form/InfoConversionApi.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ protected function getSectionId(): string
3232
*/
3333
protected function getText(): string
3434
{
35-
return 'Conversion Api options are available in <strong>Extra</strong> plans only.';
35+
return 'Conversion API is available in <strong>Extra</strong> plans only.';
3636
}
3737
}

etc/adminhtml/system.xml

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,23 @@
3535
<frontend_model>Magefan\FacebookPixel\Block\Adminhtml\System\Config\Form\EventList</frontend_model>
3636
</field>
3737
</group>
38+
<group id="conversion_api" translate="label" type="text" sortOrder="15" showInDefault="1" showInWebsite="1" showInStore="1">
39+
<field id="info" translate="label comment" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
40+
<frontend_model>Magefan\FacebookPixel\Block\Adminhtml\System\Config\Form\InfoConversionApi</frontend_model>
41+
</field>
42+
<label>Conversion API (Extra)</label>
43+
<attribute type="enabled">1</attribute>
44+
<field id="enabled" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
45+
<label>Enable Conversions API</label>
46+
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
47+
</field>
48+
<field id="access_token" translate="label comment" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
49+
<label>Access Token</label>
50+
<depends>
51+
<field id="enabled">1</field>
52+
</depends>
53+
</field>
54+
</group>
3855
<group id="attributes" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
3956
<label>Product Attributes Mapping</label>
4057
<field id="product" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
@@ -63,20 +80,6 @@
6380
<frontend_model>Magefan\FacebookPixel\Block\Adminhtml\System\Config\Form\ProtectCustomerData</frontend_model>
6481
</field>
6582
</group>
66-
<group id="conversion_api" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="1">
67-
<field id="info" translate="label comment" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
68-
<frontend_model>Magefan\FacebookPixel\Block\Adminhtml\System\Config\Form\InfoConversionApi</frontend_model>
69-
</field>
70-
<label>Conversion Api (Extra)</label>
71-
<attribute type="enabled">1</attribute>
72-
<field id="enabled" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
73-
<label>Enable Conversions API</label>
74-
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
75-
</field>
76-
<field id="access_token" translate="label comment" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
77-
<label>Access Token</label>
78-
</field>
79-
</group>
8083
</section>
8184
</system>
8285
</config>

etc/config.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
<mftype>1</mftype>
1515
<fb_pixel_id/>
1616
</general>
17+
<conversion_api>
18+
<enabled>0</enabled>
19+
<access_token/>
20+
</conversion_api>
1721
<attributes>
1822
<product>sku</product>
1923
<categories/>

view/frontend/templates/pixel.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ if (!isset($escaper)) {
2828
fbq('track', 'PageView');
2929

3030
var triedToLoadPixel = false;
31-
<?php if ($block->isSpeedOptimizationEnabled()) { ?>
31+
<?php if ($block->isSpeedOptimizationEnabled() && $block->getRequest()->getModuleName() !== 'checkout') { ?>
3232
var actionDetected = false;
3333
document.addEventListener('scroll', initMfFbPixel);
3434
document.addEventListener('mousemove', initMfFbPixel);

0 commit comments

Comments
 (0)