This commit is contained in:
2026-04-26 23:47:49 +02:00
parent 1b95f03d1e
commit b073e009d8
5288 changed files with 1112699 additions and 55536 deletions

View File

@@ -143,6 +143,15 @@ class AjaxHookEventManager {
FacebookServer()->sendEventsAsync([$event]);
}
}
if($pixel->getSlug() == "pinterest" && Pinterest()->isServerApiEnabled()) {
if($is_ajax_request) {
PinterestServer()->sendEventsNow(array($event));
} else {
PinterestServer()->sendEventsAsync(array($event));
}
}
}
AjaxHookEventManager::addPendingEvent("woo_add_to_cart_on_button_click",$dataList);
}

View File

@@ -8,7 +8,7 @@ if ( ! defined( 'ABSPATH' ) ) {
class EventsManager {
private static $_instance;
public $facebookServerEvents = array();
public $doingAMP = false;
private $standardParams = array();
@@ -19,14 +19,22 @@ class EventsManager {
public function __construct() {
add_action( 'wp_enqueue_scripts', array( $this, 'enqueueScripts' ),10 );
add_action( 'wp_enqueue_scripts', array( $this, 'setupEventsParams' ),14 );
add_action( 'wp_enqueue_scripts', array( $this, 'outputData' ),15 );
add_action( 'wp_footer', array( $this, 'outputNoScriptData' ), 10 );
}
public static function instance() {
if ( is_null( self::$_instance ) ) {
self::$_instance = new self();
}
return self::$_instance;
}
public function enqueueScripts() {
wp_register_script( 'jquery-bind-first', PYS_FREE_URL . '/dist/scripts/jquery.bind-first-0.2.3.min.js', array( 'jquery' ) );
@@ -75,7 +83,10 @@ class EventsManager {
'enable_remove_download_url_param' => PYS()->getOption( 'enable_remove_download_url_param' ),
'cookie_duration' => PYS()->getOption( 'cookie_duration' ),
'last_visit_duration' => PYS()->getOption('last_visit_duration'),
'enable_success_send_form' => PYS()->getOption( 'enable_success_send_form' ),
'enable_success_send_form' => PYS()->getOption( 'enable_success_send_form' ),
'ajaxForServerEvent' => PYS()->getOption( 'server_event_use_ajax'),
"send_external_id" => PYS()->getOption( 'send_external_id'),
"external_id_expire"=> PYS()->getOption( 'external_id_expire')
);
$options['gdpr'] = array(
@@ -87,6 +98,8 @@ class EventsManager {
'pinterest_disabled_by_api' => apply_filters( 'pys_disable_pinterest_by_gdpr', false ),
'bing_disabled_by_api' => apply_filters( 'pys_disable_bing_by_gdpr', false ),
'externalID_disabled_by_api' => apply_filters( 'pys_disable_externalID_by_gdpr', false ),
'facebook_prior_consent_enabled' => PYS()->getOption( 'gdpr_facebook_prior_consent_enabled' ),
'analytics_prior_consent_enabled' => PYS()->getOption( 'gdpr_analytics_prior_consent_enabled' ),
'google_ads_prior_consent_enabled' => PYS()->getOption( 'gdpr_google_ads_prior_consent_enabled' ),
@@ -97,7 +110,8 @@ class EventsManager {
'cookiebot_integration_enabled' => isCookiebotPluginActivated() && PYS()->getOption( 'gdpr_cookiebot_integration_enabled' ),
'cookiebot_facebook_consent_category' => PYS()->getOption( 'gdpr_cookiebot_facebook_consent_category' ),
'cookiebot_analytics_consent_category' => PYS()->getOption( 'gdpr_cookiebot_analytics_consent_category' ),
'cookiebot_google_ads_consent_category' => PYS()->getOption( 'gdpr_cookiebot_google_ads_consent_category' ),
'cookiebot_tiktok_consent_category' => PYS()->getOption( 'gdpr_cookiebot_tiktok_consent_category' ),
'cookiebot_google_ads_consent_category' => PYS()->getOption( 'gdpr_cookiebot_google_ads_consent_category' ),
'cookiebot_pinterest_consent_category' => PYS()->getOption( 'gdpr_cookiebot_pinterest_consent_category' ),
'cookiebot_bing_consent_category' => PYS()->getOption( 'gdpr_cookiebot_bing_consent_category' ),
'consent_magic_integration_enabled' => isConsentMagicPluginActivated() && PYS()->getOption( 'consent_magic_integration_enabled' ),
@@ -105,7 +119,15 @@ class EventsManager {
'cookie_notice_integration_enabled' => isCookieNoticePluginActivated() && PYS()->getOption( 'gdpr_cookie_notice_integration_enabled' ),
'cookie_law_info_integration_enabled' => isCookieLawInfoPluginActivated() && PYS()->getOption( 'gdpr_cookie_law_info_integration_enabled' ),
);
$options['cookie'] = array(
'disabled_all_cookie' => apply_filters( 'pys_disable_all_cookie', false ),
'disabled_advanced_form_data_cookie' => apply_filters( 'pys_disable_advanced_form_data_cookie', false ),
'disabled_landing_page_cookie' => apply_filters( 'pys_disable_landing_page_cookie', false ),
'disabled_first_visit_cookie' => apply_filters( 'pys_disable_first_visit_cookie', false ),
'disabled_trafficsource_cookie' => apply_filters( 'pys_disable_trafficsource_cookie', false ),
'disabled_utmTerms_cookie' => apply_filters( 'pys_disable_utmTerms_cookie', false ),
'disabled_utmId_cookie' => apply_filters( 'pys_disable_utmId_cookie', false ),
);
/**
* @var EventsFactory[] $eventsFactory
*/
@@ -125,12 +147,14 @@ class EventsManager {
}
public function outputNoScriptData() {
foreach ( PYS()->getRegisteredPixels() as $pixel ) {
/** @var Pixel|Settings $pixel */
$pixel->outputNoScriptEvents();
}
if(!apply_filters( 'pys_disable_by_gdpr', false)) {
foreach (PYS()->getRegisteredPixels() as $pixel) {
/** @var Pixel|Settings $pixel */
if (!apply_filters('pys_disable_' . $pixel->getSlug() . '_by_gdpr', false)) {
$pixel->outputNoScriptEvents();
}
}
}
}
@@ -143,25 +167,6 @@ class EventsManager {
$this->standardParams = getStandardParams();
$this->facebookServerEvents = array();
// initial event
$initEvent = new SingleEvent('init_event',EventTypes::$STATIC,'');
if(get_post_type() == "post") {
global $post;
$catIds = wp_get_object_terms( $post->ID, 'category', array( 'fields' => 'names' ) );
$initEvent->addParams([
'post_category' => implode(", ",$catIds)
]);
}
foreach ( PYS()->getRegisteredPixels() as $pixel ) {
$events = $pixel->generateEvents( $initEvent );
foreach ($events as $event) {
$event->addParams($this->standardParams);
$this->addStaticEvent( $event,$pixel,"" );
}
}
/**
* @var EventsFactory[] $eventsFactory
@@ -174,6 +179,24 @@ class EventsManager {
$this->addEvents($events,$factory->getSlug());
}
// initial event
$initEvent = new SingleEvent('init_event',EventTypes::$STATIC,'');
if(get_post_type() == "post") {
global $post;
$catIds = wp_get_object_terms( $post->ID, 'category', array( 'fields' => 'names' ) );
$initEvent->addParams([
'post_category' => implode(", ",$catIds)
]);
}
foreach ( PYS()->getRegisteredPixels() as $pixel ) {
$events = $pixel->generateEvents( $initEvent );
foreach ($events as $event) {
$event->addParams($this->standardParams);
$this->addStaticEvent( $event,$pixel,"" );
}
}
if(EventsEdd()->isEnabled()) {
// AddToCart on button
@@ -286,7 +309,7 @@ class EventsManager {
$this->staticEvents[ $pixel->getSlug() ][ $event->getId() ][] = $eventData;
// fire fb server api event
if($pixel->getSlug() == "facebook") {
if( $eventData['delay'] == 0 && !Facebook()->getOption( "server_event_use_ajax" )) {
if( $eventData['delay'] == 0 && !PYS()->getOption( "server_event_use_ajax" )) {
$this->facebookServerEvents[] = $event;
}
}
@@ -319,6 +342,9 @@ class EventsManager {
unset($data['params']['tags']);
}
if(!PYS()->getOption("enable_woo_fees_param")) {
unset($data['params']['fees']);
}
}
if($slug == EventsEdd::getSlug()) {
@@ -484,22 +510,21 @@ class EventsManager {
}
public function setupEddSingleDownloadData() {
global $post;
public function setupEddSingleDownloadData($purchase_link) {
$download = $purchase_link;
$download_ids = array();
if ( edd_has_variable_prices( $post->ID ) ) {
if ( edd_has_variable_prices( $download ) ) {
$prices = edd_get_variable_prices( $post->ID );
$prices = edd_get_variable_prices( $download );
foreach ( $prices as $price_index => $price_data ) {
$download_ids[] = $post->ID . '_' . $price_index;
$download_ids[] = $download . '_' . $price_index;
}
} else {
$download_ids[] = $post->ID;
$download_ids[] = $download;
}
@@ -528,11 +553,15 @@ class EventsManager {
<script type="application/javascript" style="display:none">
/* <![CDATA[ */
window.pysEddProductData = window.pysEddProductData || [];
window.pysEddProductData[<?php echo $post->ID; ?>] = <?php echo json_encode( $params ); ?>;
window.pysEddProductData[<?php echo $download; ?>] = <?php echo json_encode( $params ); ?>;
/* ]]> */
</script>
<?php
}
static function isTrackExternalId(){
return PYS()->getOption("send_external_id") && !apply_filters( 'pys_disable_externalID_by_gdpr', false ) && !apply_filters( 'pys_disable_all_cookie', false );
}
}

View File

@@ -46,7 +46,7 @@ final class PYS extends Settings implements Plugin {
public function getPluginVersion() {
return PYS_FREE_VERSION;
}
public function adminUpdateLicense() {}
public function __construct() {
// initialize settings
@@ -56,6 +56,7 @@ final class PYS extends Settings implements Plugin {
add_action( 'admin_init', 'PixelYourSite\manageAdminPermissions' );
// Priority 9 used to keep things same as on PRO version
add_action( 'wp', array( $this, 'set_pbid'), -1);
add_action( 'init', array( $this, 'init' ), 9 );
add_action( 'init', array( $this, 'afterInit' ), 11 );
@@ -65,7 +66,7 @@ final class PYS extends Settings implements Plugin {
add_action( 'admin_init', array( $this, 'adminProcessRequest' ), 11 );
// run Events Manager
add_action( 'template_redirect', array( $this, 'managePixels' ) );
add_action( 'template_redirect', array( $this, 'managePixels' ), 1);
// track user login event
add_action('wp_login', [$this,'userLogin'], 10, 2);
// track user registrations
@@ -87,21 +88,36 @@ final class PYS extends Settings implements Plugin {
add_action( 'wp_ajax_pys_get_gdpr_filters_values', array( $this, 'ajaxGetGdprFiltersValues' ) );
add_action( 'wp_ajax_nopriv_pys_get_gdpr_filters_values', array( $this, 'ajaxGetGdprFiltersValues' ) );
add_action( 'wp_ajax_pys_get_pbid', array( $this, 'get_pbid_ajax' ) );
add_action( 'wp_ajax_nopriv_pys_get_pbid', array( $this, 'get_pbid_ajax' ) );
/*
* Restore settings after COG plugin
* */
add_action( 'deactivate_pixel-cost-of-goods/pixel-cost-of-goods.php',array($this,"restoreSettingsAfterCog"));
add_action( 'woocommerce_checkout_create_order', array( $this,'add_order_external_meta_data'), 10, 2 );
add_filter("woocommerce_is_order_received_page",array($this,'woo_is_order_received_page'));
$this->logger = new PYS_Logger();
}
public function init() {
register_post_type( 'pys_event', array(
'public' => false,
'supports' => array( 'title' )
) );
if ( isset( $_GET[ 'clear_plugin_logs' ] ) ) {
PYS()->getLog()->remove();
$actual_link = ( isset( $_SERVER[ 'HTTPS' ] ) && $_SERVER[ 'HTTPS' ] === 'on' ? "https" : "http" ) . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
wp_redirect( remove_query_arg( 'clear_plugin_logs', $actual_link ) );
exit;
} elseif ( isset( $_GET[ 'clear_pinterest_logs' ] ) ) {
Pinterest()->getLog()->remove();
$actual_link = ( isset( $_SERVER[ 'HTTPS' ] ) && $_SERVER[ 'HTTPS' ] === 'on' ? "https" : "http" ) . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
wp_redirect( remove_query_arg( 'clear_pinterest_logs', $actual_link ) );
exit;
}
register_post_type( 'pys_event', array(
'public' => false,
'supports' => array( 'title' )
) );
// initialize options
$this->locateOptions(
@@ -153,8 +169,75 @@ final class PYS extends Settings implements Plugin {
}
EnrichOrder()->init();
AjaxHookEventManager::instance()->addHooks();
}
function get_pbid(){
$pbidCookieName = 'pbid';
if (isset($_COOKIE[$pbidCookieName])) {
return $_COOKIE[$pbidCookieName];
}
else return false;
}
public function set_pbid()
{
$pbidCookieName = 'pbid';
$externalIdExpire = PYS()->getOption("external_id_expire");
$isTrackExternalId = EventsManager::isTrackExternalId();
if (!$isTrackExternalId) {
if (isset($_COOKIE[$pbidCookieName])) {
setcookie($pbidCookieName, '', time() - 3600, '/');
}
}
if (!isset($_COOKIE[$pbidCookieName]) && $isTrackExternalId) {
$uniqueId = bin2hex(random_bytes(16));
$encryptedUniqueId = hash('sha256', $uniqueId);
setcookie($pbidCookieName, $encryptedUniqueId, time() + ($externalIdExpire * 24 * 60 * 60), '/');
return $encryptedUniqueId;
}
return null;
}
public function get_pbid_ajax(){
if(defined('DOING_AJAX') && wp_doing_ajax()){
$pbidCookieName = 'pbid';
$isTrackExternalId = EventsManager::isTrackExternalId();
if (!isset($_COOKIE[$pbidCookieName]) && $isTrackExternalId) {
$uniqueId = bin2hex(random_bytes(16));
$encryptedUniqueId = hash('sha256', $uniqueId);
wp_send_json_success( array('pbid'=>$encryptedUniqueId));
}
}
}
public function add_order_external_meta_data($order, $posted_data){
$pbidCookieName = 'pbid';
$pbid = false;
if (isset($_COOKIE[$pbidCookieName])) {
$pbid = $_COOKIE[$pbidCookieName];
}
// Добавляем мета-информацию в заказ
if(!empty($pbid)){
if ( isWooCommerceVersionGte('3.0.0') ) {
// WooCommerce версия >= 3.0
if($order) {
$order->update_meta_data( 'external_id', $pbid );
$order->save();
}
} else {
// WooCommerce версия < 3.0
update_post_meta( $order->get_id(), 'external_id', $pbid );
}
}
}
public function utmTemplate() {
include 'views/html-utm-templates.php';
}
@@ -302,13 +385,18 @@ final class PYS extends Settings implements Plugin {
}
function get_user_ip(){
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['REMOTE_ADDR'];
// Check if HTTP_X_FORWARDED_FOR is set and not empty
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
// Split the list of IPs using a comma and take the first IP
$forwarded_ips = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
$ip = trim($forwarded_ips[0]);
} elseif (!empty($_SERVER['HTTP_CLIENT_IP'])) {
// Use HTTP_CLIENT_IP if available
$ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}
return $ip;
}
@@ -333,7 +421,7 @@ final class PYS extends Settings implements Plugin {
'oBot', 'C-T bot', 'Updownerbot', 'Snoopy', 'heritrix', 'Yeti',
'DomainVader', 'DCPbot', 'PaperLiBot', 'APIs-Google', 'AdsBot-Google-Mobile',
'AdsBot-Google-Mobile', 'AdsBot-Google-Mobile-Apps', 'FeedFetcher-Google',
'Google-Read-Aloud', 'DuplexWeb-Google', 'Storebot-Google'
'Google-Read-Aloud', 'DuplexWeb-Google', 'Storebot-Google', 'lscache_runner'
);
foreach($options as $row) {
@@ -348,13 +436,21 @@ final class PYS extends Settings implements Plugin {
public function ajaxGetGdprFiltersValues() {
wp_send_json_success( array(
'all_disabled_by_api' => apply_filters( 'pys_disable_by_gdpr', false ),
'facebook_disabled_by_api' => apply_filters( 'pys_disable_facebook_by_gdpr', false ),
'analytics_disabled_by_api' => apply_filters( 'pys_disable_analytics_by_gdpr', false ),
'pinterest_disabled_by_api' => apply_filters( 'pys_disable_pinterest_by_gdpr', false ),
'bing_disabled_by_api' => apply_filters( 'pys_disable_bing_by_gdpr', false ),
) );
wp_send_json_success( array(
'all_disabled_by_api' => apply_filters( 'pys_disable_by_gdpr', false ),
'facebook_disabled_by_api' => apply_filters( 'pys_disable_facebook_by_gdpr', false ),
'analytics_disabled_by_api' => apply_filters( 'pys_disable_analytics_by_gdpr', false ),
'pinterest_disabled_by_api' => apply_filters( 'pys_disable_pinterest_by_gdpr', false ),
'bing_disabled_by_api' => apply_filters( 'pys_disable_bing_by_gdpr', false ),
'externalID_disabled_by_api' => apply_filters( 'pys_disable_externalID_by_gdpr', false ),
'disabled_all_cookie' => apply_filters( 'pys_disable_all_cookie', false ),
'disabled_advanced_form_data_cookie' => apply_filters( 'pys_disable_advanced_form_data_cookie', false ),
'disabled_landing_page_cookie' => apply_filters( 'pys_disable_landing_page_cookie', false ),
'disabled_first_visit_cookie' => apply_filters( 'pys_disable_first_visit_cookie', false ),
'disabled_trafficsource_cookie' => apply_filters( 'pys_disable_trafficsource_cookie', false ),
'disabled_utmTerms_cookie' => apply_filters( 'pys_disable_utmTerms_cookie', false ),
'disabled_utmId_cookie' => apply_filters( 'pys_disable_utmId_cookie', false ),
) );
}
@@ -465,7 +561,7 @@ final class PYS extends Settings implements Plugin {
include 'views/html-licenses.php';
}
public function adminUpdateLicense() {}
public function updatePlugin() {
@@ -760,6 +856,31 @@ final class PYS extends Settings implements Plugin {
public function getLog() {
return $this->logger;
}
function woo_is_order_received_page($flag) {
if(!$flag && !function_exists('woocommerce_gateway_stripe') && !function_exists( 'KCO_WC' )) {
global $post;
if ($post) {
if ( did_action( 'elementor/loaded' )) {
$elementor_page_id = get_option('elementor_woocommerce_purchase_summary_page_id');
if ($elementor_page_id == $post->ID) return true;
}
if(is_wc_endpoint_url( 'order-received')){
return true;
}
}
$ids = PYS()->getOption("woo_checkout_page_ids");
if(!empty($ids)) {
if($post && in_array($post->ID,$ids)) {
return true;
}
}
}
return $flag;
}
}
/**

View File

@@ -434,6 +434,35 @@ abstract class Settings {
<?php
}
public function render_switcher_input_array( $key, $index = 0) {
$attr_name = "pys[$this->slug][$key][]";
$attr_id = 'pys_' . $this->slug . '_' . $key."_".$index;
$attr_values = (array)$this->getOption( $key );
$value = "index_".$index;
$valueIndex = array_search($value,$attr_values);
$classes = array( 'custom-switch' );
$classes = implode( ' ', $classes );
?>
<div class="<?php esc_attr_e( $classes ); ?>">
<input type="checkbox"
name="<?php esc_attr_e( $attr_name ); ?>"
value="<?=$value?>"
<?=$valueIndex !== false ? "checked" : "" ?>
id="<?php esc_attr_e( $attr_id ); ?>"
class="custom-switch-input">
<label class="custom-switch-btn" for="<?php esc_attr_e( $attr_id ); ?>"></label>
</div>
<?php
}
/**
* Output checkbox input
@@ -498,7 +527,7 @@ abstract class Settings {
* @param string $placeholder
* @param bool $disabled
*/
public function render_number_input( $key, $placeholder = '', $disabled = false ) {
public function render_number_input( $key, $placeholder = '', $disabled = false,$max = null,$min = 0 ) {
$attr_name = "pys[$this->slug][$key]";
$attr_id = 'pys_' . $this->slug . '_' . $key;
@@ -510,7 +539,9 @@ abstract class Settings {
id="<?php esc_attr_e( $attr_id ); ?>"
value="<?php esc_attr_e( $attr_value ); ?>"
placeholder="<?php esc_attr_e( $placeholder ); ?>"
min="0" class="form-control">
min="<?=$min?>" class="form-control"
<?php if($max != null) : ?> max="<?=$max?>" <?php endif;?>
>
<?php
@@ -566,7 +597,7 @@ abstract class Settings {
* @param bool $disabled
*/
public function render_multi_select_input( $key, $values, $disabled = false ) {
$attr_name = "pys[$this->slug][$key][]";
$attr_id = 'pys_' . $this->slug . '_' . $key;
@@ -783,7 +814,31 @@ abstract class Settings {
return $sanitized;
}
/**
* Sanitize array field value with duplicates value
*
* @param $values
*
* @return array
*/
public function sanitize_array_v_field( $values ) {
$values = is_array( $values ) ? $values : array();
$sanitized = array();
foreach ( $values as $key => $value ) {
$new_value = $this->sanitize_text_field( $value );
if ( ! empty( $new_value ) ) {
$sanitized[ $key ] = $new_value;
}
}
return $sanitized;
}
public function render_checkbox_input_array( $key, $label, $index = 0, $disabled = false ) {
$attr_name = "pys[$this->slug][$key][]";
@@ -804,6 +859,106 @@ abstract class Settings {
<?php
}
function renderDummyTextInput( $placeholder = '' ) {
?>
<input type="text" disabled="disabled" placeholder="<?php esc_html_e( $placeholder ); ?>" class="form-control">
<?php
}
function renderDummyNumberInput($default = 0) {
?>
<input type="number" disabled="disabled" min="0" max="100" class="form-control" value="<?=$default?>">
<?php
}
function renderDummySwitcher($isEnable = false) {
$attr = $isEnable ? " checked='checked'" : "";
?>
<div class="custom-switch disabled">
<input type="checkbox" value="1" <?=$attr?> disabled="disabled" class="custom-switch-input">
<label class="custom-switch-btn"></label>
</div>
<?php
}
function renderDummyCheckbox( $label, $with_pro_badge = false ) {
?>
<label class="custom-control custom-checkbox <?php echo $with_pro_badge ? 'custom-checkbox-badge' : ''; ?>">
<input type="checkbox" value="1"
class="custom-control-input" disabled="disabled">
<span class="custom-control-indicator"></span>
<span class="custom-control-description">
<?php echo wp_kses_post( $label ); ?>
<?php if ( $with_pro_badge ) {
renderProBadge();
} ?>
</span>
</label>
<?php
}
function renderDummyRadioInput( $label, $checked = false ) {
?>
<label class="custom-control custom-radio">
<input type="radio" disabled="disabled"
class="custom-control-input" <?php checked( $checked ); ?>>
<span class="custom-control-indicator"></span>
<span class="custom-control-description"><?php echo wp_kses_post( $label ); ?></span>
</label>
<?php
}
function renderDummyTagsFields( $tags = array() ) {
?>
<select class="form-control pys-tags-pysselect2" disabled="disabled" style="width: 100%;" multiple>
<?php if(!empty($tags)){
foreach ( $tags as $tag ) : ?>
<option value="<?php echo esc_attr( $tag ); ?>" selected>
<?php echo esc_attr( $tag ); ?>
</option>
<?php endforeach;
}
?>
</select>
<?php
}
function renderDummySelectInput( $value, $full_width = false ) {
$attr_width = $full_width ? 'width: 100%;' : '';
?>
<select class="form-control form-control-sm" disabled="disabled" autocomplete="off" style="<?php esc_attr_e( $attr_width ); ?>">
<option value="" disabled selected><?php esc_html_e( $value ); ?></option>
</select>
<?php
}
function renderProBadge( $url = null,$label = "Pro Feature" ) {
if ( ! $url ) {
$url = 'https://www.pixelyoursite.com/';
}
$url = untrailingslashit( $url ) . '/?utm_source=pys-free-plugin&utm_medium=pro-badge&utm_campaign=pro-feature';
echo '&nbsp;<a href="' . esc_url( $url ) . '" target="_blank" class="badge badge-pill badge-pro">'.$label.' <i class="fa fa-external-link" aria-hidden="true"></i></a>';
}
public function convertTimeToSeconds($timeValue = 24, $type = 'hours')
{
switch ($type){

View File

@@ -70,9 +70,16 @@ class EnrichOrder {
$pysData['last_pys_utm_id'] = isset($_REQUEST['last_pys_utm_id']) ? sanitize_text_field($_REQUEST['last_pys_utm_id']) : "";
$order = wc_get_order($order_id);
if($order) {
$order->update_meta_data("pys_enrich_data",$pysData);
$order->save();
if ( isWooCommerceVersionGte('3.0.0') ) {
// WooCommerce >= 3.0
if($order) {
$order->update_meta_data("pys_enrich_data",$pysData);
$order->save();
}
} else {
// WooCommerce < 3.0
update_post_meta( $order_id, 'pys_enrich_data', $pysData );
}
}

View File

@@ -1,11 +1,25 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
use function PixelYourSite\isWooUseHPStorage;
include_once "function-helper.php";
$order = wc_get_order($orderId);
$data = $order->get_meta("pys_enrich_data",true);
$dataAnalytics = $order->get_meta("pys_enrich_data_analytics",true);
$data = array();
$dataAnalytics = array();
if(isWooUseHPStorage()) {
// WooCommerce >= 3.0
if($order) {
$data = $order->get_meta( 'pys_enrich_data', true );
}
if($dataAnalytics && is_array($dataAnalytics) && is_array($data)) {
$data = array_merge($data,$dataAnalytics);
} else {
// WooCommerce < 3.0
if(get_post_meta($orderId, "pys_enrich_data", true))
{
$data = get_post_meta($orderId, "pys_enrich_data",true);
}
}
if($data && is_array($data)) :

View File

@@ -10,6 +10,7 @@ class EventsWoo extends EventsFactory {
//"woo_big_whale",
"woo_view_content",
//"woo_view_content_for_category",
"woo_view_cart",
"woo_view_category",
"woo_view_item_list",
//"woo_view_item_list_single",
@@ -101,7 +102,9 @@ class EventsWoo extends EventsFactory {
'removeFromCartSelector' => isWooCommerceVersionGte( '3.0.0' )
? 'form.woocommerce-cart-form .remove'
: '.cart .product-remove .remove',
'addToCartCatchMethod' => PYS()->getOption('woo_add_to_cart_catch_method')
'addToCartCatchMethod' => PYS()->getOption('woo_add_to_cart_catch_method'),
'is_order_received_page' => is_order_received_page(),
'containOrderId' => wooIsRequestContainOrderId()
);
return $data;
@@ -133,8 +136,21 @@ class EventsWoo extends EventsFactory {
isset( $_REQUEST['key'] ) && $_REQUEST['key'] != ""
&& empty($_REQUEST['wc-api']) // if is not api request
) {
global $wp;
$order_key = sanitize_key($_REQUEST['key']);
$order_id = (int) wc_get_order_id_by_order_key( $order_key );
$cache_key = 'order_id_' . $order_key;
$order_id = get_transient( $cache_key );
if (is_order_received_page() && empty($order_id) && $wp->query_vars['order-received']) {
$order_id = absint( $wp->query_vars['order-received'] );
if ($order_id) {
set_transient( $cache_key, $order_id, HOUR_IN_SECONDS );
}
}
if ( empty($order_id) ) {
$order_id = (int) wc_get_order_id_by_order_key( $order_key );
set_transient( $cache_key, $order_id, HOUR_IN_SECONDS );
}
$order = wc_get_order($order_id);
if(!$order) return false;
@@ -152,6 +168,9 @@ class EventsWoo extends EventsFactory {
case 'woo_view_content' : {
return PYS()->getOption( 'woo_view_content_enabled' ) && is_product();
}
case 'woo_view_cart': {
return PYS()->getOption( 'woo_view_cart_enabled' ) && is_cart();
}
case 'woo_view_category': {
return PYS()->getOption( 'woo_view_category_enabled' ) && is_tax( 'product_cat' );
}
@@ -192,22 +211,43 @@ class EventsWoo extends EventsFactory {
case 'woo_view_item_list':
case 'woo_view_content':
return new SingleEvent($event,EventTypes::$STATIC,'woo');
case 'woo_view_cart': {
return $this->getInitCheckoutEvent($event);
}
case 'woo_add_to_cart_on_button_click':
return new SingleEvent($event,EventTypes::$DYNAMIC,'woo');
case 'woo_purchase' : {
$events = array();
$order_key = sanitize_key($_REQUEST['key']);
$order_id = (int) wc_get_order_id_by_order_key( $order_key );
$cache_key = 'order_id_' . $order_key;
$order_id = get_transient( $cache_key );
global $wp;
if (is_order_received_page() && empty($order_id) && $wp->query_vars['order-received']) {
$order_id = absint( $wp->query_vars['order-received'] );
if ($order_id) {
set_transient( $cache_key, $order_id, HOUR_IN_SECONDS );
}
}
if ( empty($order_id) ) {
$order_id = (int) wc_get_order_id_by_order_key( $order_key );
set_transient( $cache_key, $order_id, HOUR_IN_SECONDS );
}
$order = wc_get_order($order_id);
if($order) {
$order->update_meta_data("_pys_purchase_event_fired",true);
$order->save();
if ( isWooCommerceVersionGte('3.0.0') ) {
// WooCommerce >= 3.0
if($order) {
$order->update_meta_data("_pys_purchase_event_fired",true);
$order->save();
}
} else {
// WooCommerce < 3.0
update_post_meta( $order_id, '_pys_purchase_event_fired', true );
}
$events[] = new SingleEvent($event,EventTypes::$STATIC,'woo');
// add child event complete_registration
if(PYS()->getOption( 'woo_complete_registration_enabled' )) {
if(PYS()->getOption( 'woo_complete_registration_enabled' ) && Facebook()->getOption("woo_complete_registration_fire_every_time") && !Facebook()->getOption("woo_complete_registration_send_from_server")) {
$events[] = new SingleEvent('woo_complete_registration',EventTypes::$STATIC,'woo');
}
@@ -241,7 +281,9 @@ class EventsWoo extends EventsFactory {
case 'woo_view_category': {
return PYS()->getOption( 'woo_view_category_enabled' ) ;
}
case 'woo_view_cart': {
return PYS()->getOption( 'woo_view_cart_enabled' );
}
case 'woo_initiate_checkout': {
return PYS()->getOption( 'woo_initiate_checkout_enabled' );
}
@@ -304,7 +346,69 @@ class EventsWoo extends EventsFactory {
'orders_count' => null,
];
}
function getInitCheckoutEvent($eventId) {
$event = new SingleEvent($eventId,EventTypes::$STATIC,self::getSlug());
$products_data = $this->getCartProductData();
if(count($products_data) == 0) return null;
$event->args = [
'products' => $products_data,
'coupon' => $this->getCartCoupon()
];
return $event;
}
function getCartProductData() {
$products_data = [];
foreach ( WC()->cart->cart_contents as $cart_item_key => $cart_item ) {
$product_id = empty($cart_item['variation_id']) ? $cart_item['product_id'] : $cart_item['variation_id'];
$product = wc_get_product($product_id);
if(!$product) continue;
if ( $product->get_type() == 'variation' ) {
$parent_id = $product->get_parent_id(); // get terms from parent
$tags = getObjectTerms( 'product_tag', $parent_id );
$categories = getObjectTermsWithId( 'product_cat', $parent_id );
$variation_name = implode("/", $product->get_variation_attributes());
} else {
$tags = getObjectTerms( 'product_tag', $product->get_id() );
$categories = getObjectTermsWithId( 'product_cat', $product->get_id() );
$variation_name = "";
}
$sale_price = -1;
$price = getWooProductPriceToDisplay($product_id, 1,$sale_price);
$product_data = [
'product_id' => $product->get_id(),
'parent_id' => $product->get_parent_id(),
'type' => $product->get_type(),
'tags' => $tags,
'categories' => $categories,
'quantity' => $cart_item['quantity'],
'price' => $price,
'total' => pys_round($cart_item['line_total']), // with coupon sale
'total_tax' => pys_round($cart_item['line_tax']),
'subtotal' => pys_round($cart_item['line_subtotal']),
'subtotal_tax' => pys_round($cart_item['line_subtotal_tax']),
'name' => $product->get_name(),
'variation_name'=> $variation_name
];
$products_data[] = $product_data;
}
return $products_data;
}
function getCartCoupon() {
$coupons = WC()->cart->get_applied_coupons();
if ( count($coupons) > 0 ) {
$firstCoupon = reset($coupons); // Получить первый элемент массива
return $firstCoupon;
}
return null;
}
function getEvents() {
return $this->events;
}

View File

@@ -31,16 +31,25 @@ abstract class EventsFactory {
$eventsList = array();
foreach ($this->getEvents() as $eventName) {
if($this->isReadyForFire($eventName)) {
foreach ( PYS()->getRegisteredPixels() as $pixel ) {
$events = $this->getEvent($eventName);
if(!is_array($events)) $events = array($events); // some type of events can return array
foreach ($events as $event) {
$singleEvents = $pixel->generateEvents( $event );
foreach ($singleEvents as $singleEvent) {
if(!apply_filters("pys_validate_pixel_event",true,$singleEvent,$pixel)) continue;
$eventsList[$pixel->getSlug()][] = $singleEvent;
$events = $this->getEvent($eventName);
if($events == null) continue;
if(!is_array($events)) $events = array($events); // some
foreach ($events as $event) {
foreach ( PYS()->getRegisteredPixels() as $pixel ) {
if(method_exists($pixel,'generateEvents')) {
$pixelEvents = $pixel->generateEvents( $event );
foreach ($pixelEvents as $pixelEvent) {
if(apply_filters("pys_validate_pixel_event",true,$pixelEvent,$pixel)) {
$eventsList[$pixel->getSlug()][] = $pixelEvent;
}
}
}
else {
// deprecate
$pixel_event = clone $event;
$isSuccess = $pixel->addParamsToEvent( $pixel_event );
if(!$isSuccess || !apply_filters("pys_validate_pixel_event",true,$pixel_event,$pixel)) continue;
$eventsList[$pixel->getSlug()][] = $pixel_event;
}
}
}

View File

@@ -7,21 +7,21 @@ if ( ! defined( 'ABSPATH' ) ) {
}
function buildAdminUrl( $page, $tab = '', $action = '', $extra = array() ) {
$args = array( 'page' => $page );
if ( $tab ) {
$args['tab'] = $tab;
}
if ( $action ) {
$args['action'] = $action;
}
$args = array_merge( $args, $extra );
return add_query_arg( $args, admin_url( 'admin.php' ) );
}
function getCurrentAdminPage() {
@@ -47,7 +47,7 @@ function getCurrentAdminAction() {
}
function getAdminPrimaryNavTabs() {
$tabs = array(
'general' => array(
'url' => buildAdminUrl( 'pixelyoursite' ),
@@ -58,23 +58,23 @@ function getAdminPrimaryNavTabs() {
'name' => 'Events',
),
);
if ( isWooCommerceActive() ) {
$tabs['woo'] = array(
'url' => buildAdminUrl( 'pixelyoursite', 'woo' ),
'name' => 'WooCommerce',
);
}
if ( isEddActive() ) {
$tabs['edd'] = array(
'url' => buildAdminUrl( 'pixelyoursite', 'edd' ),
'name' => 'EasyDigitalDownloads',
);
}
if ( isWcfActive() ) {
@@ -90,38 +90,38 @@ function getAdminPrimaryNavTabs() {
'name' => 'Consent',
'class' => 'orange'
);
return $tabs;
}
function getAdminSecondaryNavTabs() {
$tabs = array(
'facebook_settings' => array(
'url' => buildAdminUrl( 'pixelyoursite', 'facebook_settings' ),
'name' => 'Facebook Settings',
'name' => 'Meta Settings',
),
'ga_settings' => array(
'url' => buildAdminUrl( 'pixelyoursite', 'ga_settings' ),
'name' => 'Google Analytics Settings',
),
);
$tabs = apply_filters( 'pys_admin_secondary_nav_tabs', $tabs );
$tabs['superpack_settings'] = array(
'url' => buildAdminUrl( 'pixelyoursite', 'superpack_settings' ),
'name' => 'Super Pack Settings',
);
$tabs['head_footer'] = array(
'url' => buildAdminUrl( 'pixelyoursite', 'head_footer' ),
'name' => 'Head & Footer',
);
return $tabs;
}
function cardCollapseBtn($attr = "") {
@@ -138,17 +138,17 @@ function renderCollapseTargetAttributes( $key, $settings ) {
function manageAdminPermissions() {
global $wp_roles;
$roles = PYS()->getOption( 'admin_permissions', array( 'administrator' ) );
foreach ( $wp_roles->roles as $role => $options ) {
if ( in_array( $role, $roles ) ) {
$wp_roles->add_cap( $role, 'manage_pys' );
} else {
$wp_roles->remove_cap( $role, 'manage_pys' );
}
}
}
@@ -159,7 +159,7 @@ function renderPopoverButton( $popover_id ) {
data-placement="right" data-popover_id="<?php esc_attr_e( $popover_id ); ?>">
<i class="fa fa-info-circle" aria-hidden="true"></i>
</button>
<?php
}
@@ -169,52 +169,52 @@ function renderExternalHelpIcon( $url ) {
<a class="btn btn-link" target="_blank" href="<?php echo esc_url( $url ); ?>">
<i class="fa fa-info-circle" aria-hidden="true"></i>
</a>
<?php
}
function purgeCache() {
if ( function_exists( 'w3tc_pgcache_flush' ) ) { // W3 Total Cache
w3tc_pgcache_flush();
} elseif ( function_exists( 'wp_cache_clean_cache' ) ) { // WP Super Cache
global $file_prefix, $supercachedir;
if ( empty( $supercachedir ) && function_exists( 'get_supercache_dir' ) ) {
$supercachedir = get_supercache_dir();
}
wp_cache_clean_cache( $file_prefix );
} elseif ( class_exists( 'WpeCommon' ) ) {
if ( method_exists( 'WpeCommon', 'purge_memcached' ) ) {
\WpeCommon::purge_memcached();
}
// if ( method_exists( 'WpeCommon', 'clear_maxcdn_cache' ) ) {
// \WpeCommon::clear_maxcdn_cache();
// }
if ( method_exists( 'WpeCommon', 'purge_varnish_cache' ) ) {
\WpeCommon::purge_varnish_cache();
}
} elseif ( method_exists( 'WpFastestCache', 'deleteCache' ) ) {
global $wp_fastest_cache;
if ( ! empty( $wp_fastest_cache ) ) {
$wp_fastest_cache->deleteCache();
}
} elseif ( function_exists( 'sg_cachepress_purge_cache' ) ) {
sg_cachepress_purge_cache();
}
}
function adminIncompatibleVersionNotice( $pluginName, $minVersion ) {
@@ -225,20 +225,20 @@ function adminIncompatibleVersionNotice( $pluginName, $minVersion ) {
least <?php esc_html_e( $pluginName ); ?> <?php echo $minVersion; ?>. Please, update to
latest version.</p>
</div>
<?php
}
function adminRenderNotices() {
if ( ! current_user_can( 'manage_pys' ) ) {
return;
}
/**
* Expiration notices
*/
$now = time();
$apiTokens = Facebook()->getOption('server_access_api_token');
if(Facebook()->enabled() && !$apiTokens)
@@ -259,7 +259,7 @@ function adminRenderNotices() {
adminIncompatibleVersionNotice( 'PixelYourSite Pinterest Add-On', PYS_FREE_PINTEREST_MIN_VERSION );
} elseif ( isPinterestActive() ) {
$expire_at = Pinterest()->getOption( 'license_expires' );
if ( $expire_at && $now > $expire_at ) {
adminRenderLicenseExpirationNotice( Pinterest() );
}
@@ -278,26 +278,26 @@ function adminRenderNotices() {
/**
* Pixel ID notices
*/
$facebook_pixel_id = Facebook()->getPixelIDs() ;
if ( Facebook()->enabled() && empty( $facebook_pixel_id ) ) {
$no_facebook_pixels = true;
} else {
$no_facebook_pixels = false;
}
$ga_tracking_id = GA()->getPixelIDs() ;
if ( GA()->enabled() && empty( $ga_tracking_id ) ) {
$no_ga_pixels = true;
} else {
$no_ga_pixels = false;
}
$pinterest_pixel_id = Pinterest()->getOption( 'pixel_id' );
$pinterest_license_status = Pinterest()->getOption( 'license_status' );
if ( isPinterestActive() && Pinterest()->enabled()
&& ! empty( $pinterest_license_status ) // license active or was active before
&& empty( $pinterest_pixel_id ) ) {
@@ -305,48 +305,48 @@ function adminRenderNotices() {
} else {
$no_pinterest_pixels = false;
}
if ( isPinterestActive() ) {
if ( $no_facebook_pixels && $no_ga_pixels && $no_pinterest_pixels ) {
adminRenderNoPixelsNotice();
} else {
if ( $no_facebook_pixels ) {
adminRenderNoPixelNotice( Facebook() );
}
if ( $no_ga_pixels ) {
adminRenderNoPixelNotice( GA() );
}
if ( $no_pinterest_pixels ) {
adminRenderNoPixelNotice( Pinterest() );
}
}
// show notice if licence was never activated
if (Pinterest()->enabled() && empty($pinterest_license_status)) {
adminRenderActivatePinterestLicence();
}
} else {
if ( $no_facebook_pixels && $no_ga_pixels ) {
adminRenderNoPixelsNotice();
} else {
if ( $no_facebook_pixels ) {
adminRenderNoPixelNotice( Facebook() );
}
if ( $no_ga_pixels ) {
adminRenderNoPixelNotice( GA() );
}
}
}
if ( isBingActive() ) {
@@ -359,7 +359,7 @@ function adminRenderNotices() {
}
}
/**
* GDPR
*/
@@ -372,33 +372,33 @@ function adminRenderNotices() {
* @param Plugin|Settings $plugin
*/
function adminRenderLicenseExpirationNotice( $plugin ) {
if ( 'pixelyoursite' == getCurrentAdminPage() ) {
return; // do not show notice on plugin pages
}
$slug = $plugin->getSlug();
$user_id = get_current_user_id();
// show only if never dismissed or dismissed more than a week ago
$meta_key = 'pys_' . $slug . '_expiration_notice_dismissed_at';
$dismissed_at = get_user_meta( $user_id, $meta_key );
if ( $dismissed_at ) {
if ( is_array( $dismissed_at ) ) {
$dismissed_at = reset( $dismissed_at );
}
$week_ago = time() - WEEK_IN_SECONDS;
if ( $week_ago < $dismissed_at ) {
return;
}
}
$license_key = $plugin->getOption( 'license_key' );
?>
<div class="notice notice-error is-dismissible pys_<?php esc_attr_e( $slug ); ?>_expiration_notice">
@@ -425,26 +425,26 @@ function adminRenderLicenseExpirationNotice( $plugin ) {
})
</script>
<?php
}
add_action( 'wp_ajax_pys_notice_dismiss', 'PixelYourSite\adminNoticeDismissHandler' );
function adminNoticeDismissHandler() {
if ( empty( $_REQUEST['nonce'] ) || ! wp_verify_nonce( $_REQUEST['nonce'], 'pys_notice_dismiss' ) ) {
return;
}
if ( empty( $_REQUEST['user_id'] ) || empty( $_REQUEST['addon_slug'] ) || empty( $_REQUEST['meta_key'] ) ) {
return;
}
// save time when notice was dismissed
$meta_key = 'pys_' . sanitize_text_field( $_REQUEST['addon_slug'] ) . '_' . sanitize_text_field( $_REQUEST['meta_key'] ) . '_dismissed_at';
$userId = sanitize_text_field( $_REQUEST['user_id'] );
update_user_meta($userId, $meta_key, time() );
}
function adminRenderNotCAPI( $plugin ) {
@@ -556,20 +556,20 @@ function adminRenderActivateBingLicence() {
}
function adminRenderNoPixelsNotice() {
if ( 'pixelyoursite' == getCurrentAdminPage() ) {
return; // do not show notice on plugin pages
}
$user_id = get_current_user_id();
// do not show dismissed notice
$meta_key = 'pys_core_no_pixels_dismissed_at';
$dismissed_at = get_user_meta( $user_id, $meta_key );
if ( $dismissed_at ) {
return;
}
?>
<div class="notice notice-warning is-dismissible pys_core_no_pixels_notice">
@@ -594,7 +594,7 @@ function adminRenderNoPixelsNotice() {
})
</script>
<?php
}
@@ -602,21 +602,21 @@ function adminRenderNoPixelsNotice() {
* @param Plugin|Settings $plugin
*/
function adminRenderNoPixelNotice( $plugin ) {
if ( 'pixelyoursite' == getCurrentAdminPage() ) {
return; // do not show notice on plugin pages
}
$slug = $plugin->getSlug();
$user_id = get_current_user_id();
// do not show dismissed notice
$meta_key = 'pys_' . $slug . '_no_pixel_dismissed_at';
$dismissed_at = get_user_meta( $user_id, $meta_key );
if ( $dismissed_at ) {
return;
}
?>
<div class="notice notice-warning is-dismissible pys_<?php esc_attr_e( $slug ); ?>_no_pixel_notice">
@@ -624,7 +624,7 @@ function adminRenderNoPixelNotice( $plugin ) {
<p>Add your Meta Pixel (formerly Facebook Pixel) ID and start tracking everything with PixelYourSite. <a
href="<?php echo esc_url( buildAdminUrl( 'pixelyoursite' ) ); ?>">Click Here</a></p>
<?php elseif ( $slug == 'ga' && ( isWooCommerceActive() || isEddActive() ) ) : ?>
<p>Add your Google Analytics tracking ID inside PixelYourSite and start tracking everything. Enhanced
@@ -632,19 +632,19 @@ function adminRenderNoPixelNotice( $plugin ) {
href="<?php echo esc_url( buildAdminUrl( 'pixelyoursite' ) ); ?>">Click Here</a></p>
<p>(If you use another Google Analytics plugin, disable it in order to avoid conflicts)</p>
<?php elseif ( $slug == 'ga' && ! isWooCommerceActive() && ! isEddActive() ) : ?>
<p>Add your Google Analytics ID inside PixelYourSite and start tracking everything. <a
href="<?php echo esc_url( buildAdminUrl( 'pixelyoursite' ) ); ?>">Click Here</a></p>
<p>(If you use another Google Analytics plugin, disable it in order to avoid conflicts)</p>
<?php elseif ( $slug == 'pinterest' ) : ?>
<p>Add your Pinterest pixel ID and start tracking everything with PixelYourSite. <a
href="<?php echo esc_url( buildAdminUrl( 'pixelyoursite' ) ); ?>">Click Here</a></p>
<?php endif; ?>
</div>
@@ -664,7 +664,7 @@ function adminRenderNoPixelNotice( $plugin ) {
})
</script>
<?php
}
@@ -672,15 +672,22 @@ function renderDummyTextInput( $placeholder = '' ) {
?>
<input type="text" disabled="disabled" placeholder="<?php esc_html_e( $placeholder ); ?>" class="form-control">
<?php
}
function renderDummyTextAreaInput( $placeholder = '' ) {
?>
<textarea type="text" disabled="disabled" placeholder="<?php esc_html_e( $placeholder ); ?>" class="form-control">
</textarea>
<?php
}
function renderDummyNumberInput($default = 0) {
?>
<input type="number" disabled="disabled" min="0" max="100" class="form-control" value="<?=$default?>">
<?php
}
@@ -692,7 +699,7 @@ function renderDummySwitcher($isEnable = false) {
<input type="checkbox" value="1" <?=$attr?> disabled="disabled" class="custom-switch-input">
<label class="custom-switch-btn"></label>
</div>
<?php
}
@@ -710,7 +717,7 @@ function renderDummyCheckbox( $label, $with_pro_badge = false ) {
} ?>
</span>
</label>
<?php
}
@@ -723,7 +730,7 @@ function renderDummyRadioInput( $label, $checked = false ) {
<span class="custom-control-indicator"></span>
<span class="custom-control-description"><?php echo wp_kses_post( $label ); ?></span>
</label>
<?php
}
@@ -731,7 +738,7 @@ function renderDummyTagsFields( $tags = array() ) {
?>
<select class="form-control pys-tags-pysselect2" disabled="disabled" style="width: 100%;" multiple>
<?php foreach ( $tags as $tag ) : ?>
<option value="<?php echo esc_attr( $tag ); ?>" selected>
<?php echo esc_attr( $tag ); ?>
@@ -739,20 +746,20 @@ function renderDummyTagsFields( $tags = array() ) {
<?php endforeach; ?>
</select>
<?php
}
function renderDummySelectInput( $value, $full_width = false ) {
$attr_width = $full_width ? 'width: 100%;' : '';
?>
<select class="form-control form-control-sm" disabled="disabled" autocomplete="off" style="<?php esc_attr_e( $attr_width ); ?>">
<option value="" disabled selected><?php esc_html_e( $value ); ?></option>
</select>
<?php
}
@@ -778,13 +785,13 @@ function renderDummyGoogleAdsConversionLabelInputs() {
}
function renderProBadge( $url = null,$label = "Pro Feature" ) {
if ( ! $url ) {
$url = 'https://www.pixelyoursite.com/';
}
$url = untrailingslashit( $url ) . '/?utm_source=pys-free-plugin&utm_medium=pro-badge&utm_campaign=pro-feature';
echo '&nbsp;<a href="' . esc_url( $url ) . '" target="_blank" class="badge badge-pill badge-pro">'.$label.' <i class="fa fa-external-link" aria-hidden="true"></i></a>';
}
@@ -860,4 +867,4 @@ function addMetaTagFields($pixel,$url) { ?>
</script>
</div>
</div>
<?php }
<?php }

View File

@@ -664,7 +664,31 @@ function getObjectTerms( $taxonomy, $post_id ) {
return $results;
}
/**
* @param string $taxonomy Taxonomy name
*
* @return array Array of object term names and id
*/
function getObjectTermsWithId( $taxonomy, $post_id ) {
$terms = get_the_terms( $post_id, $taxonomy );
$results = array();
if ( is_wp_error( $terms ) || empty ( $terms ) ) {
return array();
}
// decode special chars
foreach ( $terms as $term ) {
$results[] = [
'name' => html_entity_decode( $term->name ),
'id' => $term->term_id
];
}
return $results;
}
/**
* Sanitize event name. Only letters, numbers and underscores allowed.
*

View File

@@ -15,8 +15,7 @@ function isConsentMagicPluginActivated() {
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
}
return is_plugin_active( 'consent-magic-pro/consent-magic-pro.php' );
return (is_plugin_active( 'consent-magic-pro/consent-magic-pro.php' ) || is_plugin_active( 'consent-magic/consent-magic.php' )) ;
}
function isConsentMagicPluginInstalled() {
@@ -24,14 +23,20 @@ function isConsentMagicPluginInstalled() {
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
}
$installed_plugins = get_plugins();
$plugin_slug = "consent-magic-pro/consent-magic-pro.php";
return array_key_exists( $plugin_slug, $installed_plugins ) || in_array( $plugin_slug, $installed_plugins, true );
$plugin_slug = 'consent-magic/consent-magic.php';
$plugin_slug_pro = "consent-magic-pro/consent-magic-pro.php";
return
array_key_exists( $plugin_slug, $installed_plugins ) ||
in_array( $plugin_slug, $installed_plugins, true ) ||
array_key_exists( $plugin_slug_pro, $installed_plugins ) ||
in_array( $plugin_slug_pro, $installed_plugins, true );
}
function isConsentMagicPluginLicenceActivated() {
$id = get_option('cs_product_id');
if($id && get_option('wc_am_client_'.$id.'_activated') == 'Activated') {
if($id && get_option('wc_am_client_'.$id.'_activated') == 'Activated' || is_plugin_active( 'consent-magic/consent-magic.php')) {
return true;
}
return false;
@@ -109,24 +114,44 @@ function isRealCookieBannerPluginActivated() {
}
function adminGdprAjaxNotEnabledNotice() {
$user_id = get_current_user_id();
$url = buildAdminUrl( 'pixelyoursite', 'gdpr', false, array(
'_wpnonce' => wp_create_nonce( 'pys_enable_gdpr_ajax' ),
'pys' => array(
'enable_gdpr_ajax' => true,
),
) );
?>
<div class="notice notice-error pys_core_gdpr_ajax_notice">
$meta_key = 'pys_core_gdpr_ajax_notice_dismissed_at';
$dismissed_at = get_user_meta( $user_id, $meta_key );
if(!$dismissed_at){
?>
<div class="notice notice-error is-dismissible pys_core_gdpr_ajax_notice">
<p>You use the <strong>GDPR Cookie Consent</strong> and <strong>PixelYourSite</strong> plugins. You
must turn on "Enable AJAX filter values update" option to avoid problems with cache plugins.
<a href="<?php echo esc_url( $url ); ?>"><strong>CLICK HERE TO
ENABLE</strong></a>.</p>
</div>
<?php
<script type="application/javascript">
jQuery(document).on('click', '.pys_core_gdpr_ajax_notice .notice-dismiss', function () {
jQuery.ajax({
url: ajaxurl,
data: {
action: 'pys_notice_dismiss',
nonce: '<?php esc_attr_e( wp_create_nonce( 'pys_notice_dismiss' ) ); ?>',
user_id: '<?php esc_attr_e( $user_id ); ?>',
addon_slug: 'core',
meta_key: 'gdpr_ajax_notice'
}
})
})
</script>
<?php
}
}
function adminGdprAjaxEnabledNotice() {

View File

@@ -69,7 +69,7 @@ function adminRenderOptinNotices() {
padding-bottom: 15px;
}
.pys-notice-content h4 {
margin-bottom: 10px;
margin-bottom: 10px!important;
}
.pys-notice-logo {
margin-right: 15px;

View File

@@ -33,7 +33,9 @@ function wooProductIsType( $product, $type ) {
}
function wooIsRequestContainOrderId() {
global $wp;
return isset( $_REQUEST['key'] ) && $_REQUEST['key'] != ""
|| !empty($wp->query_vars['order-received'])
|| isset( $_REQUEST['referenceCode'] ) && $_REQUEST['referenceCode'] != ""
|| isset( $_REQUEST['ref_venta'] ) && $_REQUEST['ref_venta'] != ""
|| !empty( $_REQUEST['wcf-order'] );
@@ -63,7 +65,28 @@ function getWooProductPriceToDisplay( $product_id, $qty = 1 ) {
return (float) wc_get_price_to_display( $product, array( 'qty' => $qty,'price'=>$productPrice ) );
}
/**
* @param SingleEvent $event
*/
function getWooEventCartTotal($event) {
return getWooEventCartSubtotal($event);
}
/**
* @param SingleEvent $event
*/
function getWooEventCartSubtotal($event) {
$subTotal = 0;
$include_tax = get_option( 'woocommerce_tax_display_cart' ) == 'incl';
foreach ($event->args['products'] as $product) {
$subTotal += $product['subtotal'];
if($include_tax) {
$subTotal += $product['subtotal_tax'];
}
}
return pys_round($subTotal);
}
function getWooCartSubtotal() {
// subtotal is always same value on front-end and depends on PYS options
@@ -174,6 +197,19 @@ function getWooEventValueOrder( $valueOption, $order, $global, $percent = 100 )
}
function get_fees($order){
$fees = $order->get_fees();
$fee_amount = 0;
foreach ($fees as $fee) {
$fee_amount += $fee->get_total();
}
if($fee_amount > 0){
return $fee_amount;
}
return 0;
}
function getWooEventValueCart( $valueOption, $global, $percent = 100 ) {
if($valueOption == 'cog' && isPixelCogActive()) {
@@ -211,9 +247,33 @@ function getWooEventValueCart( $valueOption, $global, $percent = 100 ) {
}
function wooGetOrderIdFromRequest() {
global $wp;
if(isset( $_REQUEST['key'] ) && $_REQUEST['key'] != "") {
$order_key = sanitize_key($_REQUEST['key']);
$order_id = (int) wc_get_order_id_by_order_key( $order_key );
$cache_key = 'order_id_' . $order_key;
$order_id = get_transient( $cache_key );
if (is_order_received_page() && empty($order_id) && $wp->query_vars['order-received']) {
$order_id = absint( $wp->query_vars['order-received'] );
if ($order_id) {
set_transient( $cache_key, $order_id, HOUR_IN_SECONDS );
}
}
if ( empty($order_id) ) {
$order_id = (int) wc_get_order_id_by_order_key( $order_key );
set_transient( $cache_key, $order_id, HOUR_IN_SECONDS );
}
return $order_id;
}
if(is_order_received_page() && !empty($wp->query_vars['order-received'])){
$cache_key = 'order_id_' . $wp->query_vars['order-received'];
$order_id = get_transient( $cache_key );
if (empty($order_id)) {
$order_id = absint( $wp->query_vars['order-received'] );
if ($order_id) {
set_transient( $cache_key, $order_id, HOUR_IN_SECONDS );
}
}
return $order_id;
}
if(isset( $_REQUEST['referenceCode'] ) && $_REQUEST['referenceCode'] != "") {

View File

@@ -16,9 +16,11 @@ class PYS_Logger
*/
protected $handle = null;
public function __construct( ) {
protected $log_path = null;
}
public function __construct( ) {
$this->log_path = trailingslashit( PYS_FREE_PATH ).'logs/';
}
public function init() {
$this->isEnabled = PYS()->getOption('pys_logs_enable');
@@ -43,7 +45,7 @@ class PYS_Logger
$this->log('error',$message,$args);
}
private function log($level,$message,$args = null) {
protected function log($level,$message,$args = null) {
if(!$this->isEnabled) return;
if($args) {
$message .= " \nArgs: ".print_r($args,true);
@@ -63,7 +65,7 @@ class PYS_Logger
*
* @return bool False if value was not handled and true if value was handled.
*/
private function handle( $timestamp, $level, $message, $context ) {
protected function handle( $timestamp, $level, $message, $context ) {
$time_string = date( 'c', $timestamp );
$entry = "{$time_string} {$level} {$message}";
@@ -82,13 +84,13 @@ class PYS_Logger
return true;
}
$file = self::get_log_file_path( );
$file = static::get_log_file_path( );
if ( $file ) {
if ( ! file_exists( $file ) ) {
if(!is_dir(trailingslashit( PYS_FREE_PATH ).'logs/')) {
mkdir(trailingslashit( PYS_FREE_PATH ).'logs/', 0777, true);
}
if( !is_dir( $this->log_path ) ) {
mkdir( $this->log_path, 0777, true );
}
$temphandle = @fopen( $file, 'w+' ); // @codingStandardsIgnoreLine.
if ( is_resource( $temphandle ) ) {
@fclose( $temphandle ); // @codingStandardsIgnoreLine.
@@ -114,11 +116,11 @@ class PYS_Logger
* @return string The log file path or false if path cannot be determined.
*/
public static function get_log_file_path( ) {
return trailingslashit( PYS_FREE_PATH ).'logs/' . self::get_log_file_name( );
return trailingslashit( PYS_FREE_PATH ).'logs/' . static::get_log_file_name( );
}
public static function get_log_file_url( ) {
return trailingslashit( PYS_FREE_URL ) .'logs/'. self::get_log_file_name( );
return trailingslashit( PYS_FREE_URL ) .'logs/'. static::get_log_file_name( );
}
@@ -177,8 +179,8 @@ class PYS_Logger
}
public function getLogs( ) {
if(is_file( self::get_log_file_path() ))
return file_get_contents(self::get_log_file_path());
if(is_file( static::get_log_file_path() ))
return file_get_contents(static::get_log_file_path());
return "";
}

View File

@@ -59,6 +59,7 @@
"gdpr_bing_prior_consent_enabled": true,
"gdpr_cookiebot_integration_enabled": false,
"gdpr_cookiebot_facebook_consent_category": "marketing",
"gdpr_cookiebot_tiktok_consent_category": "marketing",
"gdpr_cookiebot_analytics_consent_category": "statistics",
"gdpr_cookiebot_pinterest_consent_category": "marketing",
"gdpr_cookiebot_bing_consent_category": "marketing",
@@ -89,6 +90,7 @@
"woo_add_to_cart_enabled": true,
"woo_view_content_enabled": true,
"woo_view_category_enabled": true,
"woo_view_cart_enabled" : true,
"woo_enabled_save_data_to_orders": true,
"woo_add_enrich_to_admin_email": true,
@@ -104,6 +106,7 @@
"enable_woo_category_name_param": true,
"enable_woo_num_items_param": true,
"enable_woo_tags_param":true,
"enable_woo_fees_param": true,
"enable_edd_category_name_param": true,
"enable_edd_num_items_param": true,
@@ -138,5 +141,9 @@
"compress_front_js": false,
"enable_success_send_form": false,
"hide_version_plugin_in_console": false
"hide_version_plugin_in_console": false,
"send_external_id": true,
"external_id_expire": 180,
"server_event_use_ajax": true
}

View File

@@ -59,6 +59,7 @@
"gdpr_bing_prior_consent_enabled": "checkbox",
"gdpr_cookiebot_integration_enabled": "checkbox",
"gdpr_cookiebot_facebook_consent_category": "text",
"gdpr_cookiebot_tiktok_consent_category": "text",
"gdpr_cookiebot_analytics_consent_category": "text",
"gdpr_cookiebot_pinterest_consent_category": "text",
"gdpr_cookiebot_bing_consent_category": "text",
@@ -88,6 +89,7 @@
"woo_add_to_cart_enabled": "checkbox",
"woo_view_content_enabled": "checkbox",
"woo_view_category_enabled": "checkbox",
"woo_view_cart_enabled" : "checkbox",
"enable_event_url_param":"checkbox",
"enable_remove_source_url_params":"checkbox",
@@ -103,6 +105,7 @@
"enable_woo_category_name_param": "checkbox",
"enable_woo_num_items_param": "checkbox",
"enable_woo_tags_param":"checkbox",
"enable_woo_fees_param": "checkbox",
"enable_edd_category_name_param": "checkbox",
"enable_edd_num_items_param": "checkbox",
"enable_edd_tags_param": "checkbox",
@@ -126,5 +129,10 @@
"automatic_event_time_on_page_value": "number",
"enable_success_send_form": "checkbox",
"hide_version_plugin_in_console": "checkbox"
"hide_version_plugin_in_console": "checkbox",
"send_external_id": "checkbox",
"external_id_expire": "number",
"server_event_use_ajax" : "checkbox"
}

View File

@@ -79,6 +79,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<div class="row">
<div class="col">
<p><a href="https://www.youtube.com/watch?v=uXTpgFu2V-E" target="_blank">The biggest problem with consent messages (7:02 min) - watch now</a></p>
<p><a href="https://www.youtube.com/watch?v=L_YYjrmxykU" target="_blank">Improve tracking under GDPR consent with this smart option (5:31 min) - watch now</a></p>
<p><a href="https://www.youtube.com/watch?v=ZOlNbIPS_Uc" target="_blank">Target your visitors with the right consent rule (12:29 min) - watch now</a></p>
<p><a href="https://www.youtube.com/watch?v=P8CLxslSPDk" target="_blank">The right to change your mind (2:46 min) - watch now</a></p>
<p><a href="https://www.youtube.com/watch?v=PsKdCkKNeLU" target="_blank">Facebook Conversion API and the Consent Problem (9:25 min) - watch now</a></p>
@@ -162,6 +163,15 @@ if ( ! defined( 'ABSPATH' ) ) {
'Enter consent category', ! isCookiebotPluginActivated() ); ?>
</div>
</div>
<div class="row mt-3">
<div class="col-4">
<label class="label-inline">Tiktok consent category:</label>
</div>
<div class="col-4">
<?php PYS()->render_text_input( 'gdpr_cookiebot_tiktok_consent_category',
'Enter consent category', ! isCookiebotPluginActivated() ); ?>
</div>
</div>
</div>
</div>
@@ -293,6 +303,37 @@ if ( ! defined( 'ABSPATH' ) ) {
</div>
</div>
</div>
<hr>
<div class="card-body">
<div class="row">
<div class="col">
<h2>Use following filters to control each cookie:</h2>
</div>
</div>
<div class="row">
<div class="col">
<p>
<p><code>pys_disable_all_cookie</code> - disable all PYS cookies</p>
<p><code>pys_disable_first_visit_cookie</code> - disable pys_first_visit cookie</p>
<p><code>pys_disable_landing_page_cookie</code> - disable pys_landing_page & last_pys_landing_page cookies</p>
<p><code>pys_disable_trafficsource_cookie</code> - disable pysTrafficSource & last_pysTrafficSource cookies</p>
<p><code>pys_disable_utmTerms_cookie</code> - disable ['utm_source', 'utm_medium', 'utm_campaign', 'utm_content' ,'utm_term'] with prefix <code>pys_</code> and <code>last_pys_</code> cookies</p>
<p><code>pys_disable_utmId_cookie</code> - disable ['fbadid', 'gadid', 'padid', 'bingid'] with prefix <code>pys_</code> and <code>last_pys_</code> cookies</p>
<p><code>pys_disable_advanced_form_data_cookie</code> - disable pys_advanced_form_data cookies</p>
<p><code>pys_disable_externalID_by_gdpr</code> - disable pbid(external_id) cookie</p>
</p>
<p class="mb-0">
To disable cookies, use filters where necessary.<br>
First filter will disable all cookies, other can be used to disable particular cookie.
Simply pass <code>__return_true</code> value to disable a cookie.
</p>
<p class="mb-0">
Example:<br>
<code>add_filter( 'pys_disable_advanced_form_data_cookie', '__return_true', 10, 2 );</code>
</p>
</div>
</div>
</div>
</div>
<hr>
@@ -300,4 +341,4 @@ if ( ! defined( 'ABSPATH' ) ) {
<div class="col-4">
<button class="btn btn-block btn-save">Save Settings</button>
</div>
</div>
</div>

View File

@@ -6,21 +6,18 @@ if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
if(isset($_GET['clear_logs'])) {
PYS()->getLog()->remove();
$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
wp_redirect(remove_query_arg( 'clear_logs',$actual_link ));
exit;
}
?>
<div class="card card-static">
<div class="card-header ">
<?php PYS()->render_switcher_input('pys_logs_enable');?> Plugin Logs
<?php PYS()->render_switcher_input('pys_logs_enable');?> Meta API Logs
<div style="float: right;margin-top: 10px;">
<a style="margin-right: 30px" href="<?php echo esc_url( buildAdminUrl( 'pixelyoursite', 'logs' ) ); ?>&clear_logs=true">Clear Logs</a>
<a href="<?= PYS_Logger::get_log_file_url() ?>" target="_blank" download>Download Logs</a>
<a style="margin-right: 30px"
href="<?php echo esc_url( buildAdminUrl( 'pixelyoursite', 'logs' ) ); ?>&clear_plugin_logs=true">Clear
Meta API Logs</a>
<a href="<?= PYS_Logger::get_log_file_url() ?>" target="_blank" download>Download Meta API Logs</a>
</div>
</div>
<div class="card-body">
@@ -30,6 +27,26 @@ if(isset($_GET['clear_logs'])) {
</div>
</div>
<?php if ( Pinterest()->enabled() ) : ?>
<div class="card card-static">
<div class="card-header ">
<?php Pinterest()->render_switcher_input( 'logs_enable' ); ?> Pinterest API Logs
<div style="float: right;margin-top: 10px;">
<a style="margin-right: 30px"
href="<?php echo esc_url( buildAdminUrl( 'pixelyoursite', 'logs' ) ); ?>&clear_pinterest_logs=true">Clear
Pinterest API Logs</a>
<a href="<?= Pinterest_logger::get_log_file_url() ?>" target="_blank" download>Download Pinterest API
Logs</a>
</div>
</div>
<div class="card-body">
<textarea style="white-space: nowrap;width: 100%;height: 500px;"><?php
echo Pinterest()->getLog()->getLogs();
?></textarea>
</div>
</div>
<?php endif; ?>
<div class="row justify-content-center">
<div class="col-4">
<button class="btn btn-block btn-sm btn-save">Save Settings</button>

View File

@@ -26,7 +26,16 @@ if ( ! defined( 'ABSPATH' ) ) {
</div>
</div>
<p class="small">
The plugin will send a purchase event using Facebook and Google Analytics API when auto-renewals take place. This feature is not yet supported for GA4 properties.
The plugin will send a Purchase event to Meta and Google using API when auto-renewals take place or when a new order is placed by an admin on the backend. Meta Conversion API token and GA4 Measurement Protocol secret are required.
</p>
<div class="row">
<div class="col">
<?php renderDummySwitcher(false); ?>
<h4 class="switcher-label">Track refunds on Goolge Analytics</h4><?php renderProBadge(); ?>
</div>
</div>
<p class="small">
A "Refund" event will be sent to Google via the API when the order status changes to "Refund". GA4 measurement protocol secret required.
</p>
</div>
</div>
@@ -37,8 +46,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<div class="card-body">
<div class="row">
<div class="col">
<p>Fire e-commerce related events. On Facebook, the events will be Dynamic Ads Ready. Enhanced Ecommerce
will be enabled for Google Analytics.</p>
<p>Fire e-commerce related events. Meta events are Dynamic Ads Ready. Monetization data is sent to Google Analytics.</p>
</div>
</div>
@@ -121,7 +129,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<h2 class="section-title">ID Settings</h2>
<?php if ( Facebook()->enabled() ) : ?>
<!-- Facebook ID -->
<div class="card">
<div class="card-header">
@@ -151,7 +159,7 @@ if ( ! defined( 'ABSPATH' ) ) {
</div>
</div>
</div>
<?php endif; ?>
<?php if ( GA()->enabled() ) : ?>
@@ -353,6 +361,11 @@ e&utm_campaign=pro-feature' ); ?>
<?php renderDummyCheckbox( "Don't fire the event for 0 value transactions", true ); ?>
</div>
</div>
<div class="row mb-3">
<div class="col-12">
<?php renderDummyCheckbox( "Don't fire the event when the number of items is 0", true ); ?>
</div>
</div>
<?php if ( Facebook()->enabled() ) : ?>
<div class="row">
<div class="col">
@@ -361,7 +374,7 @@ e&utm_campaign=pro-feature' ); ?>
</div>
</div>
<?php endif; ?>
<?php if ( Pinterest()->enabled() ) : ?>
<div class="row">
<div class="col">
@@ -411,7 +424,7 @@ e&utm_campaign=pro-feature' ); ?>
</div>
</div>
</div>
<?php if ( GA()->enabled() ) : ?>
<div class="row mb-1">
<div class="col">
@@ -454,7 +467,7 @@ e&utm_campaign=pro-feature' ); ?>
<?php PYS()->render_switcher_input('edd_initiate_checkout_enabled');?>Track the Checkout Page <?php cardCollapseBtn(); ?>
</div>
<div class="card-body">
<?php if ( Facebook()->enabled() ) : ?>
<div class="row">
<div class="col">
@@ -463,7 +476,7 @@ e&utm_campaign=pro-feature' ); ?>
</div>
</div>
<?php endif; ?>
<?php if ( Pinterest()->enabled() ) : ?>
<div class="row">
<div class="col">
@@ -515,7 +528,7 @@ e&utm_campaign=pro-feature' ); ?>
</div>
</div>
</div>
<?php if ( GA()->enabled() ) : ?>
<div class="row mb-1">
<div class="col">
@@ -549,7 +562,7 @@ e&utm_campaign=pro-feature' ); ?>
<?php PYS()->render_switcher_input('edd_add_to_cart_enabled');?>Track add to cart <?php cardCollapseBtn(); ?>
</div>
<div class="card-body">
<?php if ( Facebook()->enabled() ) : ?>
<div class="row">
<div class="col">
@@ -558,7 +571,7 @@ e&utm_campaign=pro-feature' ); ?>
</div>
</div>
<?php endif; ?>
<?php if ( Pinterest()->enabled() ) : ?>
<div class="row">
<div class="col">
@@ -610,7 +623,7 @@ e&utm_campaign=pro-feature' ); ?>
</div>
</div>
</div>
<?php if ( GA()->enabled() ) : ?>
<div class="row mb-1">
<div class="col">
@@ -644,7 +657,7 @@ e&utm_campaign=pro-feature' ); ?>
<?php PYS()->render_switcher_input('edd_view_content_enabled');?>Track product pages <?php cardCollapseBtn(); ?>
</div>
<div class="card-body">
<?php if ( Facebook()->enabled() ) : ?>
<div class="row">
<div class="col">
@@ -653,7 +666,7 @@ e&utm_campaign=pro-feature' ); ?>
</div>
</div>
<?php endif; ?>
<?php if ( Pinterest()->enabled() ) : ?>
<div class="row">
<div class="col">
@@ -712,7 +725,7 @@ e&utm_campaign=pro-feature' ); ?>
</div>
</div>
</div>
<?php if ( GA()->enabled() ) : ?>
<div class="row mb-1">
<div class="col">
@@ -746,7 +759,7 @@ e&utm_campaign=pro-feature' ); ?>
<?php PYS()->render_switcher_input('edd_view_category_enabled');?>Track product category pages <?php cardCollapseBtn(); ?>
</div>
<div class="card-body">
<?php if ( Facebook()->enabled() ) : ?>
<div class="row">
<div class="col">
@@ -755,7 +768,7 @@ e&utm_campaign=pro-feature' ); ?>
</div>
</div>
<?php endif; ?>
<?php if ( GA()->enabled() ) : ?>
<div class="row mb-1">
<div class="col">
@@ -779,7 +792,7 @@ e&utm_campaign=pro-feature' ); ?>
</div>
</div>
<?php renderDummyGoogleAdsConversionLabelInputs(); ?>
<?php if ( Pinterest()->enabled() ) : ?>
<div class="row">
<div class="col">
@@ -851,7 +864,7 @@ e&utm_campaign=pro-feature' ); ?>
<h4 class="switcher-label">Enable on Bing</h4>
</div>
</div>
<div class="row mt-3">
<div class="col col-offset-left form-inline">
<label>Fire this event when the client has at least </label>
@@ -908,7 +921,7 @@ e&utm_campaign=pro-feature' ); ?>
<h4 class="switcher-label">Enable on Bing</h4>
</div>
</div>
<div class="row mt-3">
<div class="col col-offset-left form-inline">
<label>Fire this event when the client has at least</label>
@@ -966,7 +979,7 @@ e&utm_campaign=pro-feature' ); ?>
<h4 class="switcher-label">Enable on Bing</h4>
</div>
</div>
<div class="row mt-3">
<div class="col col-offset-left form-inline">
<label>Fire this event when the client has LTV at least</label>
@@ -1049,7 +1062,7 @@ e&utm_campaign=pro-feature' ); ?>
<p>All events get the following parameters for all the tags: <i>page_title, post_type, post_id, event_URL, user_role, plugin, landing_page (pro), event_time (pro), event_day (pro), event_month (pro), traffic_source (pro), UTMs (pro).</i></p>
<p>The Purchase event will have the following extra-parameters: <i>category_name, num_items, tags, total (pro), transactions_count (pro), tax (pro), predicted_ltv (pro), average_order (pro), coupon_used (pro), coupon_code (pro), shipping (pro), shipping_cost (pro).</i></p>
<p>The Meta Pixel (formerly Facebook Pixel) events are Dynamic Ads ready.</p>
<p>The Google Analytics events track the data Enhanced Ecommerce or Monetization (GA4).</p>
<p>The Google Analytics events track Monetization data (GA4).</p>
<p>The Pinterest events have the required data for Dynamic Remarketing.</p>
</div>
</div>
@@ -1154,4 +1167,4 @@ e&utm_campaign=pro-feature' ); ?>
<div class="col-4">
<button class="btn btn-block btn-save">Save Settings</button>
</div>
</div>
</div>

View File

@@ -22,7 +22,7 @@ $serverUrl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" :
<div class="row">
<div class="col">
<div class="d-flex justify-content-between">
<span class="mt-2">With the pro version, you can fire events on clicks, mouse over and page
<span class="mt-2">With the pro version, you can fire events on clicks, mouse over elements, post type visits, or page
scroll:</span>
<a target="_blank" class="btn btn-sm btn-primary float-right" href="https://www.pixelyoursite.com/facebook-pixel-plugin/buy-pixelyoursite-pro?utm_source=pixelyoursite-free-plugin&utm_medium=plugin&utm_campaign=free-plugin-upgrade-blue">UPGRADE</a>
</div>
@@ -323,7 +323,7 @@ $serverUrl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" :
<div id="facebook_params_panel">
<div class="row mt-3">
<div class="col col-offset-left">
<div class="row mb-3 ViewContent Search AddToCart AddToWishlist InitiateCheckout AddPaymentInfo Purchase Lead CompleteRegistration Subscribe StartTrial">
<label class="col-5 control-label">value</label>
<div class="col-4">
@@ -393,7 +393,7 @@ $serverUrl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" :
<?php Events\renderFacebookParamInput( $event, 'predicted_ltv' ); ?>
</div>
</div>
<!-- Custom Facebook Params -->
<div class="row mt-3 facebook-custom-param" data-param_id="0" style="display: none;">
<div class="col-1"></div>
@@ -410,11 +410,11 @@ $serverUrl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" :
</button>
</div>
</div>
<?php foreach ( $event->getFacebookCustomParams() as $key => $custom_param ) : ?>
<?php $param_id = $key + 1; ?>
<div class="row mt-3 facebook-custom-param" data-param_id="<?php echo $param_id; ?>">
<div class="col">
<div class="row">
@@ -437,11 +437,11 @@ $serverUrl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" :
</div>
</div>
</div>
<?php endforeach; ?>
<div class="insert-marker"></div>
<div class="row mt-3">
<div class="col-5"></div>
<div class="col-4">
@@ -449,11 +449,17 @@ $serverUrl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" :
Custom Parameter</button>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<br>
<p>
<b>Important:</b> verify your custom events inside your Ads Manager:
<a href="https://www.youtube.com/watch?v=Iyu-pSbqcFI" target="_blank">watch this video to learn how</a>
</p>
</div>
</div>
<?php endif; ?>
@@ -701,13 +707,21 @@ $serverUrl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" :
<li><code>[subtotal]</code> - it will pull WooCommerce or EDD orders's subtotal when it exists</li>
</ul>
<p><strong class="text-secondary">Track URL parameters:</strong></p>
<p class="text-secondary"> Use <code>[url_ParameterName]</code> where ParameterName = the name of the parameter. <br/>
Example:<br/>
<p class="text-secondary"> Use <code>[url_ParameterName]</code> where ParameterName = the name of the parameter. <br/><br/>
Example:<br/><br/>
This is your URL: <?=$serverUrl?>?ParameterName=123<br/>
The parameter value will be 123.<br/>
</p>
<p class="text-secondary mb-0"><strong>Note:</strong> if a parameter is missing from a particular
page, the event won't include it.</p>
<br/>
<p><strong class="text-secondary">Track MemberPress plugin parameters:</strong></p>
<p class="text-secondary"> These parameters only work on a "thankyou page" with shortcode <code>[mepr-ecommerce-tracking]Message with %%variables%% in here[/mepr-ecommerce-tracking]</code><br/><br/>
All variables must have the prefix "mp_".<br/><br/>
Example:<br/><br/>
This is your MemberPress variable: total.<br/>
The parameter value will be: [mp_total].<br/>
</p>
</div>
</div>
</div>
@@ -718,4 +732,4 @@ $serverUrl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" :
<div class="col-4">
<button class="btn btn-block btn-save">Save Event</button>
</div>
</div>
</div>

View File

@@ -14,8 +14,7 @@ $new_event_url = buildAdminUrl( 'pixelyoursite', 'events', 'edit' );
<div class="row">
<div class="col">
<div class="d-flex justify-content-between">
<span class="mt-2">With the pro version, you can fire events on clicks, mouse over and page
scroll:</span>
<span class="mt-2">With the pro version, you can fire events on clicks, mouse over elements, post type visits, or page scroll:</span>
<a target="_blank" class="btn btn-sm btn-primary float-right" href="https://www.pixelyoursite.com/facebook-pixel-plugin/buy-pixelyoursite-pro?utm_source=pixelyoursite-free-plugin&utm_medium=plugin&utm_campaign=free-plugin-upgrade-blue">UPGRADE</a>
</div>
</div>
@@ -62,7 +61,6 @@ $new_event_url = buildAdminUrl( 'pixelyoursite', 'events', 'edit' );
<div class="col">
<p>All the events you configure here will automatically get the following parameters for all the tags:
<i>page_title, post_type, post_id, event_URL, user_role, plugin, landing_page (pro), event_time (pro), event_day (pro), event_month (pro), traffic_source (pro), UTMs (pro).</i></p>
<p>Exception: Google Analytics Universal will not get all these parameters. Only <i>event_time (pro), event_day (pro), event_month (pro), traffic_source (pro)</i> are sent as custom dimensions.</p>
<p>You can add other parameters when you configure the events.</p>
</div>
</div>

View File

@@ -87,12 +87,6 @@ if ( ! defined( 'ABSPATH' ) ) {
</div>
</div>
<div class="row mt-3 mb-3">
<div class="col-12">
<?php Facebook()->render_checkbox_input("server_event_use_ajax","Use Ajax when conversion API is enabled. Keep this option active if you use a cache");?>
</div>
</div>
<div class="row align-items-center mb-3">
<div class="col-12">
<h4 class="label">test_event_code :</h4>
@@ -105,6 +99,7 @@ if ( ! defined( 'ABSPATH' ) ) {
</small>
</div>
</div>
<?php if(isWPMLActive()) : ?>
<div class="row mb-3">
<div class="col-12">
@@ -137,6 +132,13 @@ if ( ! defined( 'ABSPATH' ) ) {
<input type="checkbox" id="gan_settings_switch" style="display: none">
<div class="settings_content">
<div class="plate pt-3 pb-3">
<div class="row mb-2">
<div class="col-12">
<?php renderDummySwitcher(false); ?>
<h4 class="switcher-label">Enable Measurement Protocol (add the api_secret)</h4>
<?php renderProBadge(); ?>
</div>
</div>
<div class="row mb-3">
<div class="col-12">
<h4 class="label mb-3 mt-3">Google Analytics tracking ID:</h4>
@@ -145,13 +147,26 @@ if ( ! defined( 'ABSPATH' ) ) {
<a href="https://www.pixelyoursite.com/pixelyoursite-free-version/add-your-google-analytics-code?utm_source=pixelyoursite-free-plugin&utm_medium=plugin&utm_campaign=free-plugin-ids"
target="_blank">How to get it?</a>
</small>
<div class="row align-items-center mb-3">
<div class="col-12">
<h4 class="label">Measurement Protocol API secret: <?php renderProBadge(); ?></h4>
<?php renderDummyTextInput("API secret") ?>
</div>
</div>
<div class="row mb-3">
<div class="col">
Generate the API secret inside your Google Analytics account: navigate to <b>Admin > Data Streams > choose your stream > Measurement Protocol API secrets</b>. The Measurement Protocol is used for WooCommerce and Easy Digital Downloads "Google Analytics Advanced Purchase Tracking" and refund tracking. Required for GA4 properties only.
</div>
</div>
<div class ="mt-2">
<input type="checkbox" class="custom-control-input" name="pys[ga][is_enable_debug_mode][-1]" value="0" checked />
<?php GA()->render_checkbox_input_array("is_enable_debug_mode","Enable Analytics Debug mode for this property");?>
</div>
<p>
Learn how to get the Google Analytics 4 tag ID and how to test it:
<a href="https://www.youtube.com/watch?v=fwegcsO-yrc" target="_blank">watch video</a>
<a href="https://www.youtube.com/watch?v=KkiGbfl1q48" target="_blank">watch video</a>
</p>
<p class="mt-3 ">Add multiple Google Analytics tags with the <a href="https://www.pixelyoursite.com/?utm_source=pixelyoursite-free-plugin&utm_medium=plugin&utm_campaign=free-plugin-ids"
target="_blank">pro version</a>.</p>
@@ -161,6 +176,7 @@ if ( ! defined( 'ABSPATH' ) ) {
</p>
</div>
</div>
<?php if(isWPMLActive()) : ?>
<div class="row mb-3">
<div class="col-12">
@@ -211,7 +227,7 @@ if ( ! defined( 'ABSPATH' ) ) {
target="_blank">pro version</a>.
<div class="small">TikTok Tag integration is in beta.</div>
<div class="mt-3">
How to install the TikTok tag and how to get the ID: <a href="https://www.youtube.com/watch?v=zkb67djRnd0" target="_blank">watch video</a>
How to install the TikTok tag and how to enable TikTok API: <a href="https://www.youtube.com/watch?v=OCSR6zacnFM" target="_blank">watch video</a>
</div>
</div>
</div>
@@ -251,11 +267,7 @@ if ( ! defined( 'ABSPATH' ) ) {
How to configure Custom Conversions on Meta (Facebook) based on Events & Parameters (11:03) - watch now
</a>
</p>
<p>
<a href="https://www.youtube.com/watch?v=a5jPcLbdgy0" target="_blank">
How to run A/B tests with Google Optimize and GA4 (6:07)
</a>
</p>
<p><a href="https://www.youtube.com/watch?v=snUKcsTbvCk" target="_blank">Improve META (Facebook) EMQ score
with form automatic data detection (11:48) - watch now</a></p>
<p><a href="https://www.youtube.com/watch?v=X65h4uhsMJY" target="_blank">
@@ -799,6 +811,26 @@ if ( ! defined( 'ABSPATH' ) ) {
<hr>
</div>
</div>
<div class="row">
<div class="col">
<div class="form-inline">
<?php PYS()->render_switcher_input( 'send_external_id' ); ?>
<h4 class="switcher-label">external_id</h4>
</div>
<small class="mt-1">We will store it in cookie called pbid</small>
</div>
</div>
<div class="row">
<div class="col">
<div class="form-inline">
<label>external_id expire cookie:</label>
<?php PYS()->render_number_input( 'external_id_expire', '', false, 365, 1); ?>
</div>
<hr>
</div>
</div>
<div class="row">
<div class="col">
<?php renderDummySwitcher(); ?>
@@ -881,6 +913,14 @@ if ( ! defined( 'ABSPATH' ) ) {
<h2 class="section-title mt-3">Global Settings</h2>
<div class="panel">
<div class="row mb-3">
<div class="col-12">
<?php PYS()->render_switcher_input("server_event_use_ajax" ); ?>
<h4 class="switcher-label">Use Ajax when API is enabled, or when external_id's are used. Keep this option active if you use a cache.</h4>
<div><small class="mt-1">Use Ajax when Meta conversion API, or Pinterest API are enabled, or when external_id's are used. This helps serving unique event_id values for each pair of browser/server events, ensuring deduplication works. It also ensures uniques external_id's are used for each user. Keep this option active if you use a cache solution that can serve the same event_id or the same external_id multiple times.</small></div>
<hr>
</div>
</div>
<div class="row mb-3">
<div class="col">
<?php PYS()->render_switcher_input( 'debug_enabled' ); ?>
@@ -929,7 +969,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<h4 class="switcher-label">Advanced user-data detection <a href="https://www.youtube.com/watch?v=snUKcsTbvCk" target="_blank">Watch video</a></h4>
<?php renderProBadge(); ?>
<small class="mt-1 d-block">
The plugin will try to detect user-related data like email, phone, first name, or last name and use it for subsequent Meta CAPI events personal parameters, and Meta browser events Advanced Matching. It works with most WordPress forms (email, phone number) and WooCommerce orders.
The plugin will try to detect user-related data like email, phone, first name, or last name and use it for subsequent Meta CAPI events personal parameters, and Meta browser events Advanced Matching. This data is also used for Google Ads enhanced converions, Pinterest and TikTok events.</small>
</small>
<hr>
</div>
@@ -1068,4 +1108,4 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php endif; ?>
<?php
}
}

View File

@@ -28,7 +28,16 @@ use PixelYourSite\Facebook\Helpers;
</div>
</div>
<p class="small">
If the Purchase event doesn't fire for a transaction when the order is placed by your client, the plugin will send it to Facebook and Google Analytics Universal (not yet supported for GA4) when the order's status changes to Complete.
If the default Purchase event doesn't fire when an order is placed by the client, a Purchase event will be sent to Meta and Google using API when the order status is changed to "Completed". Meta Conversion API token and GA4 Measurement Protocol secret are required.
</p>
<div class="row">
<div class="col">
<?php renderDummySwitcher( false ); ?>
<h4 class="switcher-label">Track refunds on Google Analytics</h4><?php renderProBadge(); ?>
</div>
</div>
<p class="small">
A "Refund" event will be sent to Google via the API when the order status changes to "Refund". GA4 measurement protocol secret required.
</p>
</div>
</div>
@@ -39,8 +48,7 @@ use PixelYourSite\Facebook\Helpers;
<div class="card-body">
<div class="row">
<div class="col">
<p>Fire e-commerce related events. On Facebook, the events will be Dynamic Ads Ready. Enhanced Ecommerce
will be enabled for Google Analytics.</p>
<p>Fire e-commerce related events. Meta events are Dynamic Ads Ready. Monetization data is sent to Google Analytics.</p>
</div>
</div>
@@ -68,20 +76,31 @@ use PixelYourSite\Facebook\Helpers;
<small class="form-text">Display <i>the number of orders, lifetime value, and average order</i>.</small>
</div>
</div>
<div class="row mt-2">
<div class="col">
<?php PYS()->render_switcher_input( 'woo_enabled_show_tracking_type',false,true ); ?>
<h4 class="switcher-label">Show tracking type</h4> <?php renderProBadge(); ?>
<small class="form-check">Show the tracking type in the orders table and on the on the order's page.</small>
</div>
</div>
<div class="row mt-2">
<div class="col">
<label class="mb-2">If the Purchase event doesn't work correctly, add your Checkout page(s) ID(s) here: <?php renderProBadge(); ?></label>
<?php PYS()->render_tags_select_input("woo_checkout_page_ids", true);?>
<small class="form-check">Don't add the Checkout page IDs if you use Stripe or Klarna because conflicts are possible.</small>
</div>
</div>
</div>
</div>
<div class="panel">
<div class="row">
<div class="col">
<p>Use our dedicated plugin to create auto-updating feeds for Facebook Product Catalogs, Google Merchant,
or Google Ads Custom vertical.
<p>Use our dedicated plugin to upload and update your products to Meta Product Catalogs, Google Merchant, Google Ads Custom Vertical, Pinterest Catalogs, or TikTok Catalogs.
<a href="https://www.pixelyoursite.com/product-catalog-facebook?utm_source=pixelyoursite-free-plugin&utm_medium=plugin&utm_campaign=free-plugin-catalogs-woo-tab"
target="_blank">Click to get Product Catalog Feed Pro</a></p>
<p class="mb-0">Automatically add your WooCommerce products to a Facebook Product Catalog when someone
visits them.
<a href="https://www.pixelyoursite.com/opengraph-plugin?utm_source=pixelyoursite-free-plugin&utm_medium=plugin&utm_campaign=free-plugin-catalogs-woo-tab" target="_blank">Click to get the
Smart OpenGraph plugin</a></p>
</div>
</div>
</div>
@@ -95,7 +114,7 @@ use PixelYourSite\Facebook\Helpers;
<div class="row">
<div class="col">
<p>WooCommerce AddToCart Event FIX (4:46 min) - <a href="https://www.youtube.com/watch?v=oZoAu8a0PNg" target="_blank">watch now</a></p>
<p>Improve WooCommerce Facebook Ads performance with OFFLINE CONVERSIONS (11:38) - <a href="https://www.youtube.com/watch?v=vNsiWh0cakA" target="_blank">watch now</a></p>
<p>Analyse your WooCommerce data with ChatGPT (12:06) - <a href="https://www.youtube.com/watch?v=FjGJYAdZEKc" target="_blank">watch video</a></p>
<p>Enhanced Conversions for Google Ads with PixelYourSite (9:14) - <a href="https://www.youtube.com/watch?v=0uuTiOnVw80" target="_blank">watch now</a></p>
<p>Google Analytic 4 (GA4) & WooCommerce: Transaction Reports (6:51) - <a href="https://www.youtube.com/watch?v=zLtXHbp_DDU" target="_blank">watch now</a></p>
<p>Google Analytics 4 (GA4) FUNNELS for WooCommerce (6:13) - <a href="https://www.youtube.com/watch?v=c6L1XMYzuMM" target="_blank">watch now</a></p>
@@ -106,7 +125,24 @@ use PixelYourSite\Facebook\Helpers;
</div>
</div>
</div>
<!-- Brand -->
<div class="card ">
<div class="card-header">
Brand tracking for Google Analytics <?php renderProBadge(); ?> <?php cardCollapseBtn(); ?>
</div>
<div class="card-body">
<div class="row">
<div class="col-11 form-inline">
<?php renderDummySwitcher(); ?>
<h4 class="switcher-label">Enable Brand tracking <?php renderProBadge(); ?></h4>
<div class="col-11 form-inline" style="margin-bottom: 20px; margin-top: 20px;">
<label>Brand taxonomy </label>
<?php renderDummySelectInput( 'Select taxonomy'); ?>
</div>
</div>
</div>
</div>
</div>
<!-- Transaction ID -->
<div class="card ">
<div class="card-header">
@@ -195,7 +231,7 @@ use PixelYourSite\Facebook\Helpers;
<?php $facebook_id_visibility = Helpers\isDefaultWooContentIdLogic() ? 'block' : 'none'; ?>
<?php $isShowFbID = Helpers\isFacebookForWooCommerceActive();?>
<div class="card" id="pys-section-facebook-id" style="display: <?php esc_attr_e( $facebook_id_visibility ); ?>;">
<div class="card-header">
Facebook ID setting<?php cardCollapseBtn(); ?>
@@ -205,10 +241,16 @@ use PixelYourSite\Facebook\Helpers;
<div class="col">
<?php Facebook()->render_switcher_input( 'woo_variable_as_simple' ); ?>
<h4 class="switcher-label">Treat variable products like simple products</h4>
<p class="mt-3">Turn this option ON when your Product Catalog doesn't include the variants for variable
<p class="mt-3">If you enable this option, the main ID will be used instead of the variation ID. Turn this option ON when your Product Catalog doesn't include the variants for variable
products.</p>
</div>
</div>
<div class="row mb-3">
<div class="col">
<?php renderDummySwitcher(); ?>
<h4 class="switcher-label">For product pages, track the variation data when a variation is selected <?php renderProBadge(); ?></h4>
</div>
</div>
<div class="row mb-3">
<div class="col col-offset-left form-inline">
<label>content_id</label>
@@ -246,7 +288,18 @@ use PixelYourSite\Facebook\Helpers;
<div class="col">
<?php GA()->render_switcher_input( 'woo_variable_as_simple' ); ?>
<h4 class="switcher-label">Treat variable products like simple products</h4>
<p class="mt-3">If you enable this option, the main ID will be used instead of the variation ID.</p>
<p class="mt-3">If you enable this option, the main ID will be used instead of the variation ID. Turn this option ON when your Product Catalog doesn't include the variants for variable products.</p>
</div>
</div>
<div class="row mb-3">
<div class="col">
<?php renderDummySwitcher(); ?>
<h4 class="switcher-label">For product pages, track the variation data when a variation is selected <?php renderProBadge(); ?></h4>
</div>
</div>
<div class="row mb-3">
<div class="col-12">
<?php GA()->render_checkbox_input( 'woo_variations_use_parent_name', "When tracking variations, use the parent name" ); ?>
</div>
</div>
<div class="row mb-3">
@@ -286,7 +339,7 @@ e&utm_campaign=pro-feature' ); ?>
<?php if ( Pinterest()->enabled() ) : ?>
<div class="card" id="pys-section-ga-id">
<div class="card" id="pys-section-pinterest-id">
<div class="card-header">
Pinterest Tag ID setting<?php cardCollapseBtn(); ?>
</div>
@@ -298,6 +351,12 @@ e&utm_campaign=pro-feature' ); ?>
<p class="mt-3">If you enable this option, the main ID will be used instead of the variation ID.</p>
</div>
</div>
<div class="row mb-3">
<div class="col">
<?php renderDummySwitcher(); ?>
<h4 class="switcher-label">For product pages, track the variation data when a variation is selected <?php renderProBadge(); ?></h4>
</div>
</div>
<div class="row mb-3">
<div class="col col-offset-left form-inline">
<label>ID</label>
@@ -347,6 +406,12 @@ e&utm_campaign=pro-feature' ); ?>
<p class="mt-3">If you enable this option, the main ID will be used instead of the variation ID.</p>
</div>
</div>
<div class="row mb-3">
<div class="col">
<?php renderDummySwitcher(); ?>
<h4 class="switcher-label">For product pages, track the variation data when a variation is selected <?php renderProBadge(); ?></h4>
</div>
</div>
<div class="row mb-3">
<div class="col col-offset-left form-inline">
<label>ID</label>
@@ -421,6 +486,8 @@ e&utm_campaign=pro-feature' ); ?>
<?php renderDummySelectInput( 'Include Tax' ); ?>
<label>and</label>
<?php renderDummySelectInput( 'Include Shipping' ); ?>
<label>and</label>
<?php renderDummySelectInput( 'Include Fees' ); ?>
</div>
</div>
@@ -454,6 +521,11 @@ e&utm_campaign=pro-feature' ); ?>
<?php renderDummyCheckbox( "Don't fire the event for 0 value transactions", true ); ?>
</div>
</div>
<div class="row mb-3">
<div class="col-12">
<?php renderDummyCheckbox( "Don't fire the event when the number of items is 0", true ); ?>
</div>
</div>
<div class="row mb-1">
<div class="col">
@@ -479,7 +551,7 @@ e&utm_campaign=pro-feature' ); ?>
</div>
</div>
<?php endif; ?>
<?php if ( Pinterest()->enabled() ) : ?>
<div class="row">
<div class="col">
@@ -536,7 +608,7 @@ e&utm_campaign=pro-feature' ); ?>
</div>
</div>
</div>
<?php if ( GA()->enabled() ) : ?>
<div class="row mb-1">
<div class="col">
@@ -578,7 +650,7 @@ e&utm_campaign=pro-feature' ); ?>
<?php PYS()->render_switcher_input('woo_initiate_checkout_enabled');?>Track the Checkout Page <?php cardCollapseBtn(); ?>
</div>
<div class="card-body">
<?php if ( Facebook()->enabled() ) : ?>
<div class="row">
<div class="col">
@@ -587,7 +659,7 @@ e&utm_campaign=pro-feature' ); ?>
</div>
</div>
<?php endif; ?>
<?php if ( Pinterest()->enabled() ) : ?>
<div class="row">
<div class="col">
@@ -646,7 +718,7 @@ e&utm_campaign=pro-feature' ); ?>
</div>
</div>
</div>
<?php if ( GA()->enabled() ) : ?>
<div class="row mb-1">
<div class="col">
@@ -680,7 +752,7 @@ e&utm_campaign=pro-feature' ); ?>
<?php PYS()->render_switcher_input('woo_remove_from_cart_enabled');?>Track remove from cart <?php cardCollapseBtn(); ?>
</div>
<div class="card-body">
<?php if ( Facebook()->enabled() ) : ?>
<div class="row">
<div class="col">
@@ -689,7 +761,7 @@ e&utm_campaign=pro-feature' ); ?>
</div>
</div>
<?php endif; ?>
<?php if ( GA()->enabled() ) : ?>
<div class="row mb-1">
<div class="col">
@@ -712,7 +784,7 @@ e&utm_campaign=pro-feature' ); ?>
<?php renderProBadge('https://www.pixelyoursite.com/google-ads-tag/?utm_source=pys-free-plugin&utm_medium=pro-badge&utm_campaign=pro-feature'); ?>
</div>
</div>
<?php if ( Pinterest()->enabled() ) : ?>
<div class="row">
<div class="col">
@@ -742,7 +814,7 @@ e&utm_campaign=pro-feature' ); ?>
<?php PYS()->render_switcher_input('woo_add_to_cart_enabled');?>Track add to cart <?php cardCollapseBtn(); ?>
</div>
<div class="card-body">
<?php if ( Facebook()->enabled() ) : ?>
<div class="row">
<div class="col">
@@ -751,7 +823,7 @@ e&utm_campaign=pro-feature' ); ?>
</div>
</div>
<?php endif; ?>
<?php if ( Pinterest()->enabled() ) : ?>
<div class="row">
<div class="col">
@@ -810,7 +882,7 @@ e&utm_campaign=pro-feature' ); ?>
</div>
</div>
</div>
<?php if ( GA()->enabled() ) : ?>
<div class="row mb-1">
<div class="col">
@@ -844,7 +916,7 @@ e&utm_campaign=pro-feature' ); ?>
<?php PYS()->render_switcher_input('woo_view_content_enabled');?>Track product pages <?php cardCollapseBtn(); ?>
</div>
<div class="card-body">
<?php if ( Facebook()->enabled() ) : ?>
<div class="row">
<div class="col">
@@ -853,7 +925,7 @@ e&utm_campaign=pro-feature' ); ?>
</div>
</div>
<?php endif; ?>
<?php if ( Pinterest()->enabled() ) : ?>
<div class="row">
<div class="col">
@@ -919,7 +991,7 @@ e&utm_campaign=pro-feature' ); ?>
</div>
</div>
</div>
<?php if ( GA()->enabled() ) : ?>
<div class="row mb-1">
<div class="col">
@@ -953,7 +1025,7 @@ e&utm_campaign=pro-feature' ); ?>
<?php PYS()->render_switcher_input('woo_view_category_enabled');?>Track product category pages <?php cardCollapseBtn(); ?>
</div>
<div class="card-body">
<?php if ( Facebook()->enabled() ) : ?>
<div class="row">
<div class="col">
@@ -962,21 +1034,7 @@ e&utm_campaign=pro-feature' ); ?>
</div>
</div>
<?php endif; ?>
<?php if ( GA()->enabled() ) : ?>
<div class="row mb-1">
<div class="col">
<?php GA()->render_switcher_input( 'woo_view_category_enabled' ); ?>
<h4 class="switcher-label">Enable the view_item_list event on Google Analytics</h4>
</div>
</div>
<div class="row mb-2">
<div class="col col-offset-left">
<?php GA()->render_checkbox_input( 'woo_view_category_non_interactive',
'Non-interactive event' ); ?>
</div>
</div>
<?php endif; ?>
<?php if ( Bing()->enabled() ) : ?>
<div class="row">
@@ -996,7 +1054,7 @@ e&utm_campaign=pro-feature' ); ?>
</div>
</div>
<?php renderDummyGoogleAdsConversionLabelInputs(); ?>
<?php if ( Pinterest()->enabled() ) : ?>
<div class="row">
<div class="col">
@@ -1010,7 +1068,24 @@ e&utm_campaign=pro-feature' ); ?>
</div>
</div>
<!-- ViewCart -->
<div class="card">
<div class="card-header has_switch">
<?php PYS()->render_switcher_input( 'woo_view_cart_enabled' ); ?>Track cart pages <?php cardCollapseBtn(); ?>
</div>
<div class="card-body">
<?php if ( GA()->enabled() ) : ?>
<div class="row mb-1">
<div class="col">
<?php GA()->render_switcher_input( 'woo_view_cart_enabled' ); ?>
<h4 class="switcher-label">Enable the view_cart event on Google Analytics</h4>
</div>
</div>
<?php endif; ?>
</div>
</div>
<div class="card">
<div class="card-header">
@@ -1148,7 +1223,7 @@ e&utm_campaign=pro-feature' ); ?>
<h4 class="switcher-label">Enable on Bing</h4>
</div>
</div>
<div class="row mt-3">
<div class="col col-offset-left form-inline">
<label>Fire this event when the client has at least </label>
@@ -1205,7 +1280,7 @@ e&utm_campaign=pro-feature' ); ?>
<h4 class="switcher-label">Enable on Bing</h4>
</div>
</div>
<div class="row mt-3">
<div class="col col-offset-left form-inline">
<label>Fire this event when the client has at least</label>
@@ -1249,7 +1324,7 @@ e&utm_campaign=pro-feature' ); ?>
<h4 class="switcher-label">Send the event to Google Ads</h4>
</div>
</div>
<div class="row">
<div class="col">
<?php renderDummySwitcher(); ?>
@@ -1263,7 +1338,7 @@ e&utm_campaign=pro-feature' ); ?>
<h4 class="switcher-label">Enable on Bing</h4>
</div>
</div>
<div class="row mt-3">
<div class="col col-offset-left form-inline">
<label>Fire this event when the client has LTV at least</label>
@@ -1272,7 +1347,131 @@ e&utm_campaign=pro-feature' ); ?>
</div>
</div>
</div>
<div class="card card-disabled">
<div class="card-header">
FrequentShopper Event <?php renderProBadge(); ?><?php cardCollapseBtn(); ?>
</div>
<div class="card-body">
<div class="row">
<div class="col">
<?php renderDummySwitcher(); ?>
<h4 class="switcher-label">Send the event to Facebook</h4>
</div>
</div>
<div class="row mb-1">
<div class="col">
<?php renderDummySwitcher(); ?>
<h4 class="switcher-label">Send the event to Google Analytics</h4>
</div>
</div>
<div class="row mb-2">
<div class="col col-offset-left">
<?php renderDummyCheckbox( 'Non-interactive event' ); ?>
</div>
</div>
<div class="row">
<div class="col">
<?php renderDummySwitcher(); ?>
<h4 class="switcher-label">Send the event to Google Ads</h4>
</div>
</div>
<div class="row">
<div class="col">
<?php renderDummySwitcher(); ?>
<h4 class="switcher-label">Enable on Pinterest</h4>
</div>
</div>
<div class="row">
<div class="col">
<?php renderDummySwitcher(); ?>
<h4 class="switcher-label">Enable on Bing</h4>
</div>
</div>
<div class="row mt-3">
<div class="col col-offset-left form-inline">
<label>Fire this event when the client has at least </label>
<?php renderDummyTextInput( 2 ); ?>
<label>transactions</label>
</div>
</div>
</div>
</div>
<div class="card card-disabled">
<div class="card-header has_switch">
FirstTimeBuyer Event <?php renderProBadge(); ?><?php cardCollapseBtn(); ?>
</div>
<div class="card-body">
<div class="row">
<div class="col">
<?php renderDummySwitcher(); ?>
<h4 class="switcher-label">Send the event to Facebook</h4>
</div>
</div>
<div class="row mb-1">
<div class="col">
<?php renderDummySwitcher(); ?>
<h4 class="switcher-label">Send the event to Google Analytics</h4>
</div>
</div>
<div class="row">
<div class="col">
<?php renderDummySwitcher(); ?>
<h4 class="switcher-label">Send the event to Pinterest</h4>
</div>
</div>
<div class="row">
<div class="col">
<?php renderDummySwitcher(); ?>
<h4 class="switcher-label">Send the event to Bing</h4>
</div>
</div>
</div>
</div>
<div class="card card-disabled">
<div class="card-header has_switch">
ReturingCustomer Event <?php renderProBadge(); ?><?php cardCollapseBtn(); ?>
</div>
<div class="card-body">
<div class="row">
<div class="col">
<?php renderDummySwitcher(); ?>
<h4 class="switcher-label">Send the event to Facebook</h4>
</div>
</div>
<div class="row mb-1">
<div class="col">
<?php renderDummySwitcher(); ?>
<h4 class="switcher-label">Send the event to Google Analytics</h4>
</div>
</div>
<div class="row">
<div class="col">
<?php renderDummySwitcher(); ?>
<h4 class="switcher-label">Send the event to Pinterest</h4>
</div>
</div>
<div class="row">
<div class="col">
<?php renderDummySwitcher(); ?>
<h4 class="switcher-label">Send the event to Bing</h4>
</div>
</div>
</div>
</div>
<h2 class="section-title">Extra events</h2>
<!-- Affiliate -->
@@ -1302,7 +1501,7 @@ e&utm_campaign=pro-feature' ); ?>
<h4 class="switcher-label">Enable on Bing</h4>
</div>
</div>
<div class="row my-3">
<div class="col col-offset-left form-inline">
<label>Event Type:</label>
@@ -1352,7 +1551,7 @@ e&utm_campaign=pro-feature' ); ?>
<h4 class="switcher-label">Send the event to Google Ads</h4>
</div>
</div>
</div>
</div>
@@ -1383,7 +1582,7 @@ e&utm_campaign=pro-feature' ); ?>
<h4 class="switcher-label">Enable on Bing</h4>
</div>
</div>
<div class="row my-3">
<div class="col col-offset-left form-inline">
<label>Event Type:</label>
@@ -1433,7 +1632,7 @@ e&utm_campaign=pro-feature' ); ?>
<h4 class="switcher-label">Send the event to Google Ads</h4>
</div>
</div>
</div>
</div>
@@ -1454,14 +1653,14 @@ e&utm_campaign=pro-feature' ); ?>
<br><br>
<p>The Meta Pixel (formerly Facebook Pixel) events are Dynamic Ads ready.</p>
<p>The Google Analytics events track the data Enhanced Ecommerce or Monetization (GA4).</p>
<p>The Pinterest events have the required data for Dynamic Remarketing.</p>
<p>The Google Analytics events track Monetization data (GA4).</p>
<p>The Pinterest events have the required data for Dynamic Remarketing (paid add-on requiered).</p>
<br><br>
<p>The Purchase event will have the following extra-parameters:
<i>category_name, num_items, tags, total (pro), transactions_count (pro), tax (pro),
predicted_ltv (pro), average_order (pro), coupon_used (pro), coupon_code (pro), shipping (pro),
shipping_cost (pro).</i>
shipping_cost (pro), fee (pro).</i>
</p>
</div>
</div>
@@ -1501,7 +1700,13 @@ e&utm_campaign=pro-feature' ); ?>
<hr>
</div>
</div>
<div class="row">
<div class="col">
<?php PYS()->render_switcher_input( 'enable_woo_fees_param' ); ?>
<h4 class="switcher-label">fees</h4>
<hr>
</div>
</div>
<div class="row">
<div class="col">
<?php renderDummySwitcher(); ?>
@@ -1665,4 +1870,4 @@ e&utm_campaign=pro-feature' ); ?>
<div class="col-4">
<button class="btn btn-block btn-save">Save Settings</button>
</div>
</div>
</div>

View File

@@ -14,7 +14,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<div class="row">
<div class="col">
<h2 class="section-title">WooCommerce Reports <?php renderProBadge(); ?></h2>
</div>
</div>
</div>
<div class="container">
<div class="row" style="padding:40px">
@@ -24,6 +24,9 @@ if ( ! defined( 'ABSPATH' ) ) {
<h3 class="text-center" style="margin-top:40px">Get detailed info about products sold by each campaign, ad set, or ad</h3>
<a href="https://www.pixelyoursite.com/woocommerce-first-party-reports?utm_source=free-plugin-reports-page-woo&utm_medium=free-plugin-reports-page-woo&utm_campaign=free-plugin-reports-page-woo&utm_content=free-plugin-reports-page-woo&utm_term=free-plugin-reports-page-woo"
target="_blank" class="btn btn-save" style="margin-top:30px">Click to find more</a>
<h3 class="text-center" style="margin-top:40px">Analyse your WooCommerce data with ChatGPT</h3>
<a href="https://www.pixelyoursite.com/pixelyoursite-and-chatgpt?utm_source=free-plugin-reports-page-woo&utm_medium=free-plugin-reports-page-woo&utm_campaign=free-plugin-reports-page-woo&utm_content=free-plugin-reports-page-woo&utm_term=free-plugin-reports-page-woo"
target="_blank" class="btn btn-save" style="margin-top:30px">Click to find more</a>
</div>
</div>
</div>

View File

@@ -85,7 +85,15 @@ include "html-popovers.php";
case 'head_footer':
/** @noinspection PhpIncludeInspection */
include PYS_FREE_PATH . '/modules/head_footer/views/html-admin-page.php';
if ( current_user_can( 'manage_pys' ) && current_user_can('unfiltered_html') )
{
include PYS_FREE_PATH . '/modules/head_footer/views/html-admin-page.php';
}
else
{
include PYS_FREE_PATH . '/modules/head_footer/views/html-admin-not-permission-page.php';
}
break;
case 'facebook_settings':
@@ -209,8 +217,8 @@ include "html-popovers.php";
<div class="card card-static border-primary">
<div class="card-body">
<h4 class="card-title">WooCommerce Product Catalog Feeds</h4>
<p class="card-text">Generate auto-updating WooCommerce XML feeds for Facebook Product
Catalog, Google Merchant, and Google Ads (custom type).</p>
<p class="card-text">Generate auto-updating WooCommerce XML feeds for Meta Product
Catalog, Google Merchant, Google Ads (custom type), Pinterst Catalogs, or TikTok Catalogs.</p>
<a href="https://www.pixelyoursite.com/product-catalog-facebook?utm_source=free&utm_medium=plugin&utm_campaign=right-column-free" target="_blank"
class="btn btn-sm btn-block btn-primary">Click for details</a>
</div>