first commit
This commit is contained in:
94
wp-content/plugins/pixelyoursite/modules/bing/bing.php
Normal file
94
wp-content/plugins/pixelyoursite/modules/bing/bing.php
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
namespace PixelYourSite;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
class Bing extends Settings implements Pixel {
|
||||
|
||||
private static $_instance = null;
|
||||
|
||||
public static function instance() {
|
||||
|
||||
if ( is_null( self::$_instance ) ) {
|
||||
self::$_instance = new self();
|
||||
}
|
||||
|
||||
return self::$_instance;
|
||||
|
||||
}
|
||||
|
||||
public function __construct() {
|
||||
add_action( 'pys_admin_pixel_ids', array( $this, 'renderPixelIdField' ) );
|
||||
}
|
||||
|
||||
public function enabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function configured() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getPixelIDs() {
|
||||
return array();
|
||||
}
|
||||
|
||||
public function getPixelOptions() {
|
||||
return array();
|
||||
}
|
||||
|
||||
public function getEventData( $eventType, $args = null ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function outputNoScriptEvents() {}
|
||||
|
||||
public function render_switcher_input( $key, $collapse = false, $disabled = false ) {
|
||||
|
||||
$attr_id = 'pys_bing_' . $key;
|
||||
|
||||
?>
|
||||
|
||||
<div class="custom-switch disabled">
|
||||
<input type="checkbox" value="1" disabled="disabled"
|
||||
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
|
||||
}
|
||||
|
||||
public function renderCustomEventOptions( $event ) {}
|
||||
|
||||
public function renderAddonNotice() {
|
||||
echo ' <a href="https://www.pixelyoursite.com/bing-tag?utm_source=pys-free-plugin&utm_medium=bing-badge&utmcampaign=bing-free-plugin" target="_blank" class="badge badge-pill badge-secondary">Requires paid add-on</a>';
|
||||
}
|
||||
|
||||
public function renderPixelIdField() {
|
||||
?>
|
||||
|
||||
<div class="row align-items-center">
|
||||
<div class="col-2 py-4">
|
||||
<img class="tag-logo" src="<?php echo PYS_FREE_URL; ?>/dist/images/microsoft-small-square.png">
|
||||
</div>
|
||||
<div class="col-10">
|
||||
<h4 class="label">Microsoft the UET Tag (Bing) with <a href="https://www.pixelyoursite.com/bing-tag?utm_source=pixelyoursite-free-plugin&utm_medium=plugin&utm_campaign=free-plugin-bing" target="_blank">this pro add-on.</a></h4>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Bing
|
||||
*/
|
||||
function Bing() {
|
||||
return Bing::instance();
|
||||
}
|
||||
|
||||
Bing();
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace PixelYourSite;
|
||||
|
||||
/**
|
||||
* Class FDPEvent
|
||||
* @property string event_name
|
||||
* @property string content_type
|
||||
* @property string trigger_type
|
||||
* @property string trigger_value
|
||||
* */
|
||||
class FDPEvent
|
||||
{
|
||||
private $data = array();
|
||||
|
||||
public function __get( $key ) {
|
||||
if(isset($this->data[$key])) return $this->data[$key];
|
||||
return "";
|
||||
}
|
||||
|
||||
public function __set( $key,$value ){
|
||||
$this->data[$key] = $value;
|
||||
}
|
||||
|
||||
public function hasTimeWindow() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getTimeWindow() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,379 @@
|
||||
<?php
|
||||
namespace PixelYourSite;
|
||||
|
||||
use PixelYourSite;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\ServerSide\Event;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\ServerSide\UserData;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\ServerSide\CustomData;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\ServerSide\Content;
|
||||
defined('ABSPATH') or die('Direct access not allowed');
|
||||
|
||||
|
||||
class ServerEventHelper {
|
||||
|
||||
/**
|
||||
* @param SingleEvent $event
|
||||
* @return Event | null
|
||||
*/
|
||||
public static function mapEventToServerEvent($event) {
|
||||
|
||||
$eventData = $event->getData();
|
||||
$eventData = EventsManager::filterEventParams($eventData,$event->getCategory(),[
|
||||
'event_id'=>$event->getId(),
|
||||
'pixel'=>Facebook()->getSlug()
|
||||
]);
|
||||
|
||||
$eventName = $eventData['name'];
|
||||
$eventParams = $eventData['params'];
|
||||
$eventId = $event->payload['eventID'];
|
||||
$wooOrder = isset($event->payload['woo_order']) ? $event->payload['woo_order'] : null;
|
||||
$eddOrder = isset($event->payload['edd_order']) ? $event->payload['edd_order'] : null;
|
||||
|
||||
if(!$eventId) return null;
|
||||
|
||||
$user_data = ServerEventHelper::getUserData($wooOrder,$eddOrder)
|
||||
->setClientIpAddress(self::getIpAddress())
|
||||
->setClientUserAgent(self::getHttpUserAgent());
|
||||
|
||||
|
||||
$fbp = self::getFbp();
|
||||
$fbc = self::getFbc();
|
||||
|
||||
if(!$fbp && $wooOrder) {
|
||||
$fbp = ServerEventHelper::getFbStatFromOrder('fbp',$wooOrder);
|
||||
}
|
||||
if(!$fbc && $wooOrder) {
|
||||
$fbc = ServerEventHelper::getFbStatFromOrder('fbc',$wooOrder);
|
||||
}
|
||||
|
||||
$user_data->setFbp($fbp);
|
||||
$user_data->setFbc($fbc);
|
||||
|
||||
$customData = self::paramsToCustomData($eventParams);
|
||||
$uri = self::getRequestUri(PYS()->getOption('enable_remove_source_url_params'));
|
||||
|
||||
// set custom uri use in ajax request
|
||||
if(isset($_POST['url'])) {
|
||||
if(PYS()->getOption('enable_remove_source_url_params')) {
|
||||
$list = explode("?",$_POST['url']);
|
||||
if(is_array($list) && count($list) > 0) {
|
||||
$uri = $list[0];
|
||||
} else {
|
||||
$uri = $_POST['url'];
|
||||
}
|
||||
} else {
|
||||
$uri = $_POST['url'];
|
||||
}
|
||||
}
|
||||
|
||||
$event = (new Event())
|
||||
->setEventName($eventName)
|
||||
->setEventTime(time())
|
||||
->setEventId($eventId)
|
||||
->setEventSourceUrl($uri)
|
||||
->setActionSource("website")
|
||||
->setCustomData($customData)
|
||||
->setUserData($user_data);
|
||||
|
||||
|
||||
return $event;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $key
|
||||
* @param $wooOrder
|
||||
* @return string|null
|
||||
*/
|
||||
private static function getFbStatFromOrder($key,$wooOrder) {
|
||||
|
||||
$order = wc_get_order( $wooOrder );
|
||||
if($order) {
|
||||
$fbCookie = $order->get_meta('pys_fb_cookie',true);
|
||||
if($fbCookie){
|
||||
if(!empty($fbCookie[$key])) {
|
||||
return $fbCookie[$key];
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private static function getIpAddress() {
|
||||
$HEADERS_TO_SCAN = array(
|
||||
'HTTP_CLIENT_IP',
|
||||
'HTTP_X_FORWARDED_FOR',
|
||||
'HTTP_X_FORWARDED',
|
||||
'HTTP_X_CLUSTER_CLIENT_IP',
|
||||
'HTTP_FORWARDED_FOR',
|
||||
'HTTP_FORWARDED',
|
||||
'REMOTE_ADDR'
|
||||
);
|
||||
|
||||
foreach ($HEADERS_TO_SCAN as $header) {
|
||||
if (array_key_exists($header, $_SERVER)) {
|
||||
$ip_list = explode(',', $_SERVER[$header]);
|
||||
foreach($ip_list as $ip) {
|
||||
$trimmed_ip = trim($ip);
|
||||
if (self::isValidIpAddress($trimmed_ip)) {
|
||||
return $trimmed_ip;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return "127.0.0.1";
|
||||
}
|
||||
|
||||
private static function isValidIpAddress($ip_address) {
|
||||
return filter_var($ip_address,
|
||||
FILTER_VALIDATE_IP,
|
||||
FILTER_FLAG_IPV4
|
||||
| FILTER_FLAG_IPV6
|
||||
| FILTER_FLAG_NO_PRIV_RANGE
|
||||
| FILTER_FLAG_NO_RES_RANGE);
|
||||
}
|
||||
|
||||
private static function getHttpUserAgent() {
|
||||
$user_agent = null;
|
||||
|
||||
if (!empty($_SERVER['HTTP_USER_AGENT'])) {
|
||||
$user_agent = $_SERVER['HTTP_USER_AGENT'];
|
||||
}
|
||||
|
||||
return $user_agent;
|
||||
}
|
||||
|
||||
private static function getRequestUri($removeQuery = false) {
|
||||
$request_uri = null;
|
||||
|
||||
if (!empty($_SERVER['REQUEST_URI'])) {
|
||||
$start = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http")."://";
|
||||
$request_uri = $start.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
|
||||
}
|
||||
if($removeQuery && isset($_SERVER['QUERY_STRING'])) {
|
||||
$request_uri = str_replace("?".$_SERVER['QUERY_STRING'],"",$request_uri);
|
||||
}
|
||||
|
||||
|
||||
return $request_uri;
|
||||
}
|
||||
|
||||
public static function getFbp() {
|
||||
$fbp = null;
|
||||
|
||||
if (!empty($_COOKIE['_fbp'])) {
|
||||
$fbp = $_COOKIE['_fbp'];
|
||||
}
|
||||
|
||||
return $fbp;
|
||||
}
|
||||
|
||||
public static function getFbc() {
|
||||
$fbc = null;
|
||||
|
||||
if (!empty($_COOKIE['_fbc'])) {
|
||||
$fbc = $_COOKIE['_fbc'];
|
||||
}
|
||||
|
||||
return $fbc;
|
||||
}
|
||||
|
||||
private static function getUserData($wooOrder = null,$eddOrder = null) {
|
||||
$userData = new UserData();
|
||||
|
||||
/**
|
||||
* Add purchase WooCommerce Advanced Matching params
|
||||
*/
|
||||
if ( PixelYourSite\isWooCommerceActive() && isEventEnabled( 'woo_purchase_enabled' ) &&
|
||||
($wooOrder || ( is_order_received_page() && wooIsRequestContainOrderId() ))
|
||||
) {
|
||||
if(wooIsRequestContainOrderId()) {
|
||||
$order_id = wooGetOrderIdFromRequest();
|
||||
} else {
|
||||
$order_id = $wooOrder;
|
||||
}
|
||||
|
||||
$order = wc_get_order( $order_id );
|
||||
|
||||
if ( $order ) {
|
||||
|
||||
if ( PixelYourSite\isWooCommerceVersionGte( '3.0.0' ) ) {
|
||||
if($order->get_billing_postcode()) {
|
||||
$userData->setZipCode($order->get_billing_postcode());
|
||||
}
|
||||
if($order->get_billing_country()) {
|
||||
$userData->setCountryCode(strtolower($order->get_billing_country()));
|
||||
}
|
||||
if($order->get_billing_email()) {
|
||||
$userData->setEmail($order->get_billing_email());
|
||||
}
|
||||
|
||||
if($order->get_billing_phone()) {
|
||||
$userData->setPhone($order->get_billing_phone());
|
||||
}
|
||||
|
||||
if($order->get_billing_first_name()) {
|
||||
$userData->setFirstName($order->get_billing_first_name());
|
||||
}
|
||||
|
||||
if($order->get_billing_last_name()) {
|
||||
$userData->setLastName($order->get_billing_last_name());
|
||||
}
|
||||
|
||||
if($order->get_billing_city()) {
|
||||
$userData->setCity($order->get_billing_city());
|
||||
}
|
||||
|
||||
if($order->get_billing_state()) {
|
||||
$userData->setState($order->get_billing_state());
|
||||
}
|
||||
|
||||
} else {
|
||||
if($order->billing_postcode) {
|
||||
$userData->setZipCode($order->billing_postcode);
|
||||
}
|
||||
$userData->setCountryCode(strtolower($order->billing_country));
|
||||
$userData->setEmail($order->billing_email);
|
||||
$userData->setPhone($order->billing_phone);
|
||||
$userData->setFirstName($order->billing_first_name);
|
||||
$userData->setLastName($order->billing_last_name);
|
||||
$userData->setCity($order->billing_city);
|
||||
$userData->setState($order->billing_state);
|
||||
}
|
||||
} else {
|
||||
return ServerEventHelper::getRegularUserData();
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if(PixelYourSite\isEddActive() && isEventEnabled( 'edd_purchase_enabled' ) &&
|
||||
($eddOrder || edd_is_success_page()) ) {
|
||||
|
||||
if($eddOrder)
|
||||
$payment_id = $eddOrder;
|
||||
else {
|
||||
$payment_key = getEddPaymentKey();
|
||||
$payment_id = (int) edd_get_purchase_id_by_key( $payment_key );
|
||||
}
|
||||
$user_info = edd_get_payment_meta_user_info($payment_id);
|
||||
$email = edd_get_payment_user_email($payment_id);
|
||||
if($email) {
|
||||
$userData->setEmail($email);
|
||||
}
|
||||
|
||||
|
||||
if(isset($user_info['first_name']))
|
||||
$userData->setFirstName($user_info['first_name']);
|
||||
if(isset($user_info['last_name']))
|
||||
$userData->setLastName($user_info['last_name']);
|
||||
|
||||
} else {
|
||||
return ServerEventHelper::getRegularUserData();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return $userData;
|
||||
}
|
||||
|
||||
private static function getRegularUserData() {
|
||||
$user = wp_get_current_user();
|
||||
$userData = new UserData();
|
||||
if ( $user->ID ) {
|
||||
// get user regular data
|
||||
$userData->setFirstName($user->get( 'user_firstname' ));
|
||||
$userData->setLastName($user->get( 'user_lastname' ));
|
||||
$userData->setEmail($user->get( 'user_email' ));
|
||||
|
||||
/**
|
||||
* Add common WooCommerce Advanced Matching params
|
||||
*/
|
||||
if ( PixelYourSite\isWooCommerceActive() ) {
|
||||
// if first name is not set in regular wp user meta
|
||||
if (empty($userData->getFirstName())) {
|
||||
$userData->setFirstName($user->get('billing_first_name'));
|
||||
}
|
||||
|
||||
// if last name is not set in regular wp user meta
|
||||
if (empty($userData->getLastName())) {
|
||||
$userData->setLastName($user->get('billing_last_name'));
|
||||
}
|
||||
|
||||
if($user->get('billing_phone'))
|
||||
$userData->setPhone($user->get('billing_phone'));
|
||||
if($user->get('billing_city'))
|
||||
$userData->setCity($user->get('billing_city'));
|
||||
if($user->get('billing_state'))
|
||||
$userData->setState($user->get('billing_state'));
|
||||
if($user->get('shipping_country'))
|
||||
$userData->setCountryCode(strtolower($user->get('shipping_country')));
|
||||
if($user->get('billing_postcode')) {
|
||||
$userData->setZipCode($user->get('billing_postcode'));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// $userData->setFirstName("undefined");
|
||||
// $userData->setLastName("undefined");
|
||||
// $userData->setEmail("undefined");
|
||||
}
|
||||
return $userData;
|
||||
}
|
||||
|
||||
static function paramsToCustomData($data) {
|
||||
|
||||
if(isset($data['contents']) && is_array($data['contents'])) {
|
||||
$contents = array();
|
||||
foreach ($data['contents'] as $c) {
|
||||
$contents[] = new Content([
|
||||
'product_id' => $c['id'],
|
||||
'quantity' => $c['quantity']
|
||||
]);
|
||||
}
|
||||
$data['contents'] = $contents;
|
||||
} else {
|
||||
$data['contents'] = array();
|
||||
}
|
||||
|
||||
$customData = new CustomData($data);
|
||||
$customProperties = array();
|
||||
|
||||
|
||||
if(isset($data['category_name'])) {
|
||||
$customData->setContentCategory($data['category_name']);
|
||||
}
|
||||
|
||||
$custom_values = ['event_action','download_type','download_name','download_url','target_url','text','trigger','traffic_source','plugin','user_role','event_url','page_title',"post_type",'post_id','categories','tags','video_type',
|
||||
'video_id','video_title','event_trigger','link_type','tag_text',"URL",
|
||||
'form_id','form_class','form_submit_label','transactions_count','average_order',
|
||||
'shipping_cost','tax','total','shipping','coupon_used','post_category','landing_page'];
|
||||
|
||||
|
||||
$adding_custom_field = array();
|
||||
|
||||
$eventsCustom = EventsCustom()->getEvents();
|
||||
foreach ($eventsCustom as $event)
|
||||
{
|
||||
$fbCustomEvents = $event->getFacebookCustomParams();
|
||||
|
||||
foreach ($fbCustomEvents as $paramKey => $params)
|
||||
{
|
||||
if(!in_array($params['name'], $custom_values))
|
||||
{
|
||||
$adding_custom_field[] = $params['name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
$result_custom_values = array_merge($custom_values, $adding_custom_field);
|
||||
foreach ($result_custom_values as $val) {
|
||||
if(isset($data[$val])){
|
||||
$customProperties[$val] = $data[$val];
|
||||
}
|
||||
}
|
||||
|
||||
$customData->setCustomProperties($customProperties);
|
||||
return $customData;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
namespace PixelYourSite;
|
||||
|
||||
|
||||
defined('ABSPATH') or die('Direct access not allowed');
|
||||
|
||||
|
||||
class FacebookAsyncTask extends \WP_Async_Task {
|
||||
protected $action = 'pys_send_server_event';
|
||||
|
||||
protected function prepare_data($data) {
|
||||
try {
|
||||
if (!empty($data)) {
|
||||
if(empty($this->_body_data)) {
|
||||
return array('data' => base64_encode(serialize($data)));
|
||||
} else {
|
||||
//error_log("_body_data".print_r($this->_body_data,true));
|
||||
$oldData = unserialize(base64_decode($this->_body_data['data']));
|
||||
$data = [array_merge($oldData[0],$data[0])];
|
||||
return array('data' => base64_encode(serialize($data)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
error_log($ex);
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
protected function run_action() {
|
||||
try {
|
||||
$data = unserialize(base64_decode($_POST['data']));
|
||||
|
||||
$events = is_array($data[0]) ? $data[0] : $data ;
|
||||
if (empty($events)) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($events as $event) {
|
||||
FacebookServer()->sendEvent($event["pixelIds"],$event["event"]);
|
||||
}
|
||||
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
error_log($ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,333 @@
|
||||
<?php
|
||||
namespace PixelYourSite;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
/*
|
||||
* @see https://github.com/facebook/facebook-php-business-sdk
|
||||
* This class use for sending facebook server events
|
||||
*/
|
||||
|
||||
require_once PYS_FREE_PATH . '/modules/facebook/facebook-server-async-task.php';
|
||||
require_once PYS_FREE_PATH . '/modules/facebook/PYSServerEventHelper.php';
|
||||
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Api;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Http\Exception\RequestException;
|
||||
use PYS_PRO_GLOBAL\FacebookAds\Object\ServerSide\EventRequest;
|
||||
|
||||
|
||||
class FacebookServer {
|
||||
|
||||
private static $_instance;
|
||||
private $isEnabled;
|
||||
private $hours = ['00-01', '01-02', '02-03', '03-04', '04-05', '05-06', '06-07', '07-08',
|
||||
'08-09', '09-10', '10-11', '11-12', '12-13', '13-14', '14-15', '15-16', '16-17',
|
||||
'17-18', '18-19', '19-20', '20-21', '21-22', '22-23', '23-24'
|
||||
];
|
||||
private $access_token;
|
||||
private $testCode;
|
||||
private $isDebug;
|
||||
|
||||
public static function instance() {
|
||||
|
||||
if ( is_null( self::$_instance ) ) {
|
||||
self::$_instance = new self();
|
||||
}
|
||||
|
||||
return self::$_instance;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function __construct() {
|
||||
|
||||
$this->isEnabled = Facebook()->enabled() && Facebook()->isServerApiEnabled();
|
||||
$this->isDebug = PYS()->getOption( 'debug_enabled' );
|
||||
|
||||
if($this->isEnabled) {
|
||||
add_action( 'woocommerce_checkout_update_order_meta',array($this,'saveFbTagsInOrder'),10, 2);
|
||||
add_action( 'wp_ajax_pys_api_event',array($this,"catchAjaxEvent"));
|
||||
add_action( 'wp_ajax_nopriv_pys_api_event', array($this,"catchAjaxEvent"));
|
||||
add_action( 'woocommerce_remove_cart_item', array($this, 'trackRemoveFromCartEvent'), 10, 2);
|
||||
add_action( 'woocommerce_add_to_cart', array($this, 'trackAddToCartEvent'), 40, 4);
|
||||
|
||||
//add_action( 'woocommerce_order_status_completed', array( $this, 'completed_purchase' ) );
|
||||
// initialize the s2s event async task
|
||||
new FacebookAsyncTask();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send event in shutdown hook (not work in ajax)
|
||||
* @param SingleEvent[] $events
|
||||
*/
|
||||
public function sendEventsAsync($events) {
|
||||
|
||||
$serverEvents = [];
|
||||
foreach ($events as $event) {
|
||||
$ids = $event->payload['pixelIds'];
|
||||
$serverEvents[] = [
|
||||
"pixelIds" => $ids,
|
||||
"event" => ServerEventHelper::mapEventToServerEvent($event)
|
||||
];
|
||||
}
|
||||
|
||||
if(count($serverEvents) > 0) {
|
||||
do_action('pys_send_server_event', $serverEvents);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send Event Now
|
||||
*
|
||||
* @param SingleEvent[] $events
|
||||
*/
|
||||
public function sendEventsNow($events) {
|
||||
|
||||
foreach ($events as $event) {
|
||||
$serverEvent = ServerEventHelper::mapEventToServerEvent($event);
|
||||
$ids = $event->payload['pixelIds'];
|
||||
|
||||
$this->sendEvent($ids,$serverEvent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tracks a completed purchase
|
||||
*
|
||||
* @param int $order_id the order ID
|
||||
*/
|
||||
function completed_purchase($order_id) {
|
||||
$order = wc_get_order($order_id);
|
||||
if(!$order
|
||||
|| $order->get_meta( '_pys_purchase_event_fired', true )
|
||||
|| !PYS()->getOption( 'woo_purchase_enabled' )) {
|
||||
return;
|
||||
}
|
||||
add_filter("pys_woo_checkout_order_id",function () use ($order_id) {return $order_id;});
|
||||
$event = EventsWoo()->getEvent('woo_purchase');
|
||||
if ( $event == null ) {
|
||||
return;
|
||||
}
|
||||
$events = Facebook()->generateEvents($event);
|
||||
|
||||
foreach ($events as $singleEvent) {
|
||||
if(isset($_COOKIE['pys_landing_page']))
|
||||
$singleEvent->addParams(['landing_page'=>$_COOKIE['pys_landing_page']]);
|
||||
}
|
||||
|
||||
$this->sendEventsNow($events);
|
||||
}
|
||||
|
||||
function trackAddToCartEvent($cart_item_key, $product_id, $quantity, $variation_id) {
|
||||
if(EventsWoo()->isReadyForFire("woo_add_to_cart_on_button_click")
|
||||
&& PYS()->getOption('woo_add_to_cart_catch_method') == "add_cart_js")
|
||||
{
|
||||
PYS()->getLog()->debug('trackAddToCartEvent send fb server with out browser event');
|
||||
if( !empty($variation_id)
|
||||
&& $variation_id > 0
|
||||
&& ( !Facebook()->getOption( 'woo_variable_as_simple' )
|
||||
|| ( Facebook()->getSlug() == "facebook"
|
||||
&& !Facebook\Helpers\isDefaultWooContentIdLogic()
|
||||
)
|
||||
)
|
||||
) {
|
||||
$_product_id = $variation_id;
|
||||
} else {
|
||||
$_product_id = $product_id;
|
||||
}
|
||||
|
||||
$event = new SingleEvent("woo_add_to_cart_on_button_click",EventTypes::$DYNAMIC,'woo');
|
||||
$event->args = ['productId' => $_product_id,'quantity' => $quantity];
|
||||
add_filter('pys_conditional_post_id', function($id) use ($product_id) { return $product_id; });
|
||||
$events = Facebook()->generateEvents($event);
|
||||
remove_all_filters('pys_conditional_post_id');
|
||||
|
||||
foreach ($events as $singleEvent) {
|
||||
|
||||
if(isset($_COOKIE['pys_landing_page']))
|
||||
$singleEvent->addParams(['landing_page'=>$_COOKIE['pys_landing_page']]);
|
||||
|
||||
if(isset($_COOKIE["pys_fb_event_id"])) {
|
||||
$singleEvent->payload['eventID'] = json_decode(stripslashes($_COOKIE["pys_fb_event_id"]))->AddToCart;
|
||||
}
|
||||
}
|
||||
|
||||
$this->sendEventsAsync($events);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param String $cart_item_key
|
||||
* @param \WC_Cart $cart
|
||||
*/
|
||||
|
||||
function trackRemoveFromCartEvent ($cart_item_key,$cart) {
|
||||
$eventId = 'woo_remove_from_cart';
|
||||
|
||||
$url = $_SERVER['HTTP_HOST'].strtok($_SERVER["REQUEST_URI"], '?');
|
||||
$postId = url_to_postid($url);
|
||||
$cart_id = wc_get_page_id( 'cart' );
|
||||
$item = $cart->get_cart_item($cart_item_key);
|
||||
|
||||
|
||||
|
||||
if(PYS()->getOption( 'woo_remove_from_cart_enabled') && $cart_id==$postId) {
|
||||
PYS()->getLog()->debug('trackRemoveFromCartEvent send fb server with out browser event');
|
||||
$event = new SingleEvent("woo_remove_from_cart",EventTypes::$STATIC,'woo');
|
||||
$event->args=['item'=>$item];
|
||||
|
||||
$events = Facebook()->generateEvents($event);
|
||||
|
||||
foreach ($events as $singleEvent) {
|
||||
$singleEvent->addParams(getStandardParams());
|
||||
if(isset($_COOKIE['pys_landing_page'])){
|
||||
$singleEvent->addParams(['landing_page'=>$_COOKIE['pys_landing_page']]);
|
||||
}
|
||||
if(isset($_COOKIE["pys_fb_event_id"])) {
|
||||
$singleEvent->payload['eventID'] = json_decode(stripslashes($_COOKIE["pys_fb_event_id"]))->RemoveFromCart;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$this->sendEventsAsync($events);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If server message is blocked by gprg or it dynamic
|
||||
* we send data by ajax request from js and send the same data like browser event
|
||||
*/
|
||||
function catchAjaxEvent() {
|
||||
PYS()->getLog()->debug('catchAjaxEvent send fb server from ajax');
|
||||
$event = $_POST['event'];
|
||||
$data = isset($_POST['data']) ? $_POST['data'] : array();
|
||||
$ids = $_POST['ids'];
|
||||
$eventID = $_POST['eventID'];
|
||||
$wooOrder = isset($_POST['woo_order']) ? $_POST['woo_order'] : null;
|
||||
$eddOrder = isset($_POST['edd_order']) ? $_POST['edd_order'] : null;
|
||||
|
||||
|
||||
if ( empty( $_REQUEST['ajax_event'] ) || !wp_verify_nonce( $_REQUEST['ajax_event'], 'ajax-event-nonce' ) ) {
|
||||
wp_die();
|
||||
return;
|
||||
}
|
||||
|
||||
if($event == "hCR") $event="CompleteRegistration"; // de mask completer registration event if it was hidden
|
||||
|
||||
$singleEvent = $this->dataToSingleEvent($event,$data,$eventID,$ids,$wooOrder,$eddOrder);
|
||||
|
||||
$this->sendEventsNow([$singleEvent]);
|
||||
|
||||
wp_die();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $eventName
|
||||
* @param $params
|
||||
* @param $eventID
|
||||
* @param $ids
|
||||
* @param $wooOrder
|
||||
* @param $eddOrder
|
||||
* @return SingleEvent
|
||||
*/
|
||||
private function dataToSingleEvent($eventName,$params,$eventID,$ids,$wooOrder,$eddOrder) {
|
||||
$singleEvent = new SingleEvent("","");
|
||||
|
||||
$payload = [
|
||||
'name' => $eventName,
|
||||
'eventID' => $eventID,
|
||||
'woo_order' => $wooOrder,
|
||||
'edd_order' => $eddOrder,
|
||||
'pixelIds' => $ids
|
||||
];
|
||||
$singleEvent->addParams($params);
|
||||
$singleEvent->addPayload($payload);
|
||||
|
||||
return $singleEvent;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Send event for each pixel id
|
||||
* @param array $pixel_Ids //array of facebook ids
|
||||
* @param \PYS_PRO_GLOBAL\FacebookAds\Object\ServerSide\Event $event //One Facebook event object
|
||||
*/
|
||||
function sendEvent($pixel_Ids, $event) {
|
||||
|
||||
if (!$event || apply_filters('pys_disable_server_event_filter',false)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(!$this->access_token) {
|
||||
$this->access_token = Facebook()->getApiToken();
|
||||
$this->testCode = Facebook()->getApiTestCode();
|
||||
}
|
||||
|
||||
foreach($pixel_Ids as $pixel_Id) {
|
||||
|
||||
if(empty($this->access_token[$pixel_Id])) continue;
|
||||
|
||||
$event->setEventId($event->getEventId());
|
||||
|
||||
$api = Api::init(null, null, $this->access_token[$pixel_Id],false);
|
||||
|
||||
/**
|
||||
* filter pys_before_send_fb_server_event
|
||||
* Help add custom options or get data from event before send
|
||||
* FacebookAds\Object\ServerSide\Event $event
|
||||
* String $pixel_Id
|
||||
* String EventId
|
||||
*/
|
||||
$event = apply_filters("pys_before_send_fb_server_event",$event,$pixel_Id,$event->getEventId());
|
||||
|
||||
$request = (new EventRequest($pixel_Id))->setEvents([$event]);
|
||||
$request->setPartnerAgent("dvpixelyoursite");
|
||||
if(!empty($this->testCode[$pixel_Id])) {
|
||||
$request->setTestEventCode($this->testCode[$pixel_Id]);
|
||||
}
|
||||
|
||||
PYS()->getLog()->debug('Send FB server event',$request);
|
||||
try{
|
||||
$response = $request->execute();
|
||||
PYS()->getLog()->debug('Response from FB server',$response);
|
||||
} catch (\Exception $e) {
|
||||
if($e instanceof RequestException) {
|
||||
PYS()->getLog()->error('Error send FB server event '.$e->getErrorUserMessage(),$e->getResponse());
|
||||
} else {
|
||||
PYS()->getLog()->error('Error send FB server event',$e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function saveFbTagsInOrder($order_id, $data) {
|
||||
$pysData = [];
|
||||
$pysData['fbc'] = ServerEventHelper::getFbc();
|
||||
$pysData['fbp'] = ServerEventHelper::getFbp();
|
||||
$order = wc_get_order($order_id);
|
||||
if($order) {
|
||||
$order->update_meta_data("pys_fb_cookie",$pysData);
|
||||
$order->save();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return FacebookServer
|
||||
*/
|
||||
function FacebookServer() {
|
||||
return FacebookServer::instance();
|
||||
}
|
||||
|
||||
FacebookServer();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1294
wp-content/plugins/pixelyoursite/modules/facebook/facebook.php
Normal file
1294
wp-content/plugins/pixelyoursite/modules/facebook/facebook.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,585 @@
|
||||
<?php
|
||||
|
||||
namespace PixelYourSite\Facebook\Helpers;
|
||||
|
||||
use PixelYourSite;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
function getAdvancedMatchingParams() {
|
||||
|
||||
$params = array();
|
||||
$user = wp_get_current_user();
|
||||
|
||||
if ( $user->ID ) {
|
||||
|
||||
// get user regular data
|
||||
$params['fn'] = $user->get( 'user_firstname' );
|
||||
$params['ln'] = $user->get( 'user_lastname' );
|
||||
$params['em'] = $user->get( 'user_email' );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Add common WooCommerce Advanced Matching params
|
||||
*/
|
||||
|
||||
if ( PixelYourSite\isWooCommerceActive() ) {
|
||||
|
||||
// if first name is not set in regular wp user meta
|
||||
if ( empty( $params['fn'] ) ) {
|
||||
$params['fn'] = $user->get( 'billing_first_name' );
|
||||
}
|
||||
|
||||
// if last name is not set in regular wp user meta
|
||||
if ( empty( $params['ln'] ) ) {
|
||||
$params['ln'] = $user->get( 'billing_last_name' );
|
||||
}
|
||||
|
||||
$params['ph'] = $user->get( 'billing_phone' );
|
||||
$params['ct'] = $user->get( 'billing_city' );
|
||||
$params['st'] = $user->get( 'billing_state' );
|
||||
|
||||
$params['country'] = $user->get( 'billing_country' );
|
||||
|
||||
/**
|
||||
* Add purchase WooCommerce Advanced Matching params
|
||||
*/
|
||||
|
||||
if ( is_order_received_page() && isset( $_REQUEST['key'] ) && $_REQUEST['key'] != "" ) {
|
||||
$key = sanitize_key($_REQUEST['key']);
|
||||
$order_id = wc_get_order_id_by_order_key($key );
|
||||
$order = wc_get_order( $order_id );
|
||||
|
||||
if ( $order ) {
|
||||
|
||||
if ( PixelYourSite\isWooCommerceVersionGte( '3.0.0' ) ) {
|
||||
|
||||
$params = array(
|
||||
'em' => $order->get_billing_email(),
|
||||
'ph' => $order->get_billing_phone(),
|
||||
'fn' => $order->get_billing_first_name(),
|
||||
'ln' => $order->get_billing_last_name(),
|
||||
'ct' => $order->get_billing_city(),
|
||||
'st' => $order->get_billing_state(),
|
||||
'country' => $order->get_billing_country(),
|
||||
);
|
||||
|
||||
} else {
|
||||
|
||||
$params = array(
|
||||
'em' => $order->billing_email,
|
||||
'ph' => $order->billing_phone,
|
||||
'fn' => $order->billing_first_name,
|
||||
'ln' => $order->billing_last_name,
|
||||
'ct' => $order->billing_city,
|
||||
'st' => $order->billing_state,
|
||||
'country' => $order->billing_country,
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Add common EDD Advanced Matching params
|
||||
*/
|
||||
|
||||
if ( PixelYourSite\isEddActive()) {
|
||||
|
||||
/**
|
||||
* Add purchase EDD Advanced Matching params
|
||||
*/
|
||||
|
||||
// skip payment confirmation page
|
||||
if ( edd_is_success_page() && ! isset( $_GET['payment-confirmation'] ) ) {
|
||||
global $edd_receipt_args;
|
||||
|
||||
$session = edd_get_purchase_session();
|
||||
if ( isset( $_GET['payment_key'] ) ) {
|
||||
$payment_key = urldecode( $_GET['payment_key'] );
|
||||
} else if ( $session ) {
|
||||
$payment_key = $session['purchase_key'];
|
||||
} elseif ( $edd_receipt_args && $edd_receipt_args['payment_key'] ) {
|
||||
$payment_key = $edd_receipt_args['payment_key'];
|
||||
}
|
||||
|
||||
if ( isset( $payment_key ) ) {
|
||||
|
||||
$payment_id = edd_get_purchase_id_by_key( $payment_key );
|
||||
|
||||
if ( $payment = edd_get_payment( $payment_id ) ) {
|
||||
|
||||
// if first name is not set in regular wp user meta
|
||||
if ( empty( $params['fn'] ) ) {
|
||||
$params['fn'] = $payment->user_info['first_name'];
|
||||
}
|
||||
|
||||
// if last name is not set in regular wp user meta
|
||||
if ( empty( $params['ln'] ) ) {
|
||||
$params['ln'] = $payment->user_info['last_name'];
|
||||
}
|
||||
|
||||
$params['ct'] = $payment->address['city'];
|
||||
$params['st'] = $payment->address['state'];
|
||||
|
||||
$params['country'] = $payment->address['country'];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$sanitized = array();
|
||||
|
||||
foreach ( $params as $key => $value ) {
|
||||
|
||||
if ( ! empty( $value ) ) {
|
||||
$sanitized[ $key ] = sanitizeAdvancedMatchingParam( $value, $key );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $sanitized;
|
||||
|
||||
}
|
||||
|
||||
function sanitizeAdvancedMatchingParam( $value, $key ) {
|
||||
|
||||
// prevents fatal error when mb_string extension not enabled
|
||||
if ( function_exists( 'mb_strtolower' ) ) {
|
||||
$value = mb_strtolower( $value );
|
||||
} else {
|
||||
$value = strtolower( $value );
|
||||
}
|
||||
|
||||
if ( $key == 'ph' ) {
|
||||
$value = preg_replace( '/\D/', '', $value );
|
||||
} elseif ( $key == 'em' ) {
|
||||
$value = preg_replace( '/[^a-z0-9._+-@]+/i', '', $value );
|
||||
} else {
|
||||
$value = preg_replace( '/[^a-z]/', '', $value );
|
||||
}
|
||||
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $product_id
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function getFacebookWooProductContentId( $product_id ) {
|
||||
|
||||
if ( PixelYourSite\Facebook()->getOption( 'woo_content_id' ) == 'product_sku' ) {
|
||||
$content_id = get_post_meta( $product_id, '_sku', true );
|
||||
} else {
|
||||
$content_id = $product_id;
|
||||
}
|
||||
|
||||
$prefix = PixelYourSite\Facebook()->getOption( 'woo_content_id_prefix' );
|
||||
$suffix = PixelYourSite\Facebook()->getOption( 'woo_content_id_suffix' );
|
||||
|
||||
$value = $prefix . $content_id . $suffix;
|
||||
$value = array( $value );
|
||||
|
||||
// Facebook for WooCommerce plugin integration
|
||||
if ( ! isDefaultWooContentIdLogic() ) {
|
||||
|
||||
$product = wc_get_product($product_id);
|
||||
|
||||
if ( ! $product ) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
|
||||
$ids = array(
|
||||
get_fb_plugin_retailer_id($product)
|
||||
);
|
||||
|
||||
$value = array_values( array_filter( $ids ) );
|
||||
|
||||
}
|
||||
|
||||
return $value;
|
||||
|
||||
}
|
||||
function get_fb_plugin_retailer_id( $woo_product ) {
|
||||
if(!$woo_product) return "";
|
||||
$woo_id = $woo_product->get_id();
|
||||
|
||||
// Call $woo_product->get_id() instead of ->id to account for Variable
|
||||
// products, which have their own variant_ids.
|
||||
return $woo_product->get_sku() ? $woo_product->get_sku() . '_' .
|
||||
$woo_id : 'wc_post_id_'. $woo_id;
|
||||
}
|
||||
function getFacebookWooCartItemId( $item ) {
|
||||
|
||||
if ( ! PixelYourSite\Facebook()->getOption( 'woo_variable_as_simple' ) && isset( $item['variation_id'] ) && $item['variation_id'] !== 0 ) {
|
||||
$product_id = $item['variation_id'];
|
||||
} else {
|
||||
$product_id = $item['product_id'];
|
||||
}
|
||||
|
||||
// Facebook for WooCommerce plugin integration
|
||||
if ( ! isDefaultWooContentIdLogic() ) {
|
||||
|
||||
if ( isset( $item['variation_id'] ) && $item['variation_id'] !== 0 ) {
|
||||
$product_id = $item['variation_id'];
|
||||
} else {
|
||||
$product_id = $item['product_id'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $product_id;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds "content_name" and "category_name" params
|
||||
*/
|
||||
function getWooCustomAudiencesOptimizationParams( $post_id ) {
|
||||
|
||||
$post = get_post( $post_id );
|
||||
|
||||
$params = array(
|
||||
'content_name' => '',
|
||||
'category_name' => '',
|
||||
);
|
||||
|
||||
if ( ! $post ) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
if ( $post->post_type == 'product_variation' ) {
|
||||
$post_id = $post->post_parent; // get terms from parent
|
||||
}
|
||||
|
||||
$params['content_name'] = $post->post_title;
|
||||
$params['category_name'] = implode( ', ', PixelYourSite\getObjectTerms( 'product_cat', $post_id ) );
|
||||
|
||||
return $params;
|
||||
|
||||
}
|
||||
|
||||
function getWooSingleAddToCartParams( $_product_id, $qty = 1 ) {
|
||||
|
||||
$params = array();
|
||||
$product = wc_get_product($_product_id);
|
||||
if(!$product) return array();
|
||||
$product_ids = array();
|
||||
$isGrouped = $product->get_type() == "grouped";
|
||||
if($isGrouped) {
|
||||
$product_ids = $product->get_children();
|
||||
} else {
|
||||
$product_ids[] = $_product_id;
|
||||
}
|
||||
$params['content_type'] = 'product';
|
||||
$params['content_ids'] = array();
|
||||
$params['contents'] = array();
|
||||
|
||||
|
||||
|
||||
|
||||
// content_name, category_name, tags
|
||||
$params['tags'] = implode( ', ', PixelYourSite\getObjectTerms( 'product_tag', $_product_id ) );
|
||||
$params = array_merge( $params, getWooCustomAudiencesOptimizationParams( $_product_id ) );
|
||||
|
||||
// currency, value
|
||||
if ( PixelYourSite\PYS()->getOption( 'woo_add_to_cart_value_enabled' ) ) {
|
||||
|
||||
$value_option = PixelYourSite\PYS()->getOption( 'woo_add_to_cart_value_option' );
|
||||
$global_value = PixelYourSite\PYS()->getOption( 'woo_add_to_cart_value_global', 0 );
|
||||
|
||||
$params['value'] = PixelYourSite\getWooEventValue( $value_option, $global_value,100, $_product_id,$qty );
|
||||
$params['currency'] = get_woocommerce_currency();
|
||||
|
||||
}
|
||||
|
||||
foreach ($product_ids as $product_id) {
|
||||
$product = wc_get_product($product_id);
|
||||
if(!$product) continue;
|
||||
if($product->get_type() == "variable" && $isGrouped) {
|
||||
continue;
|
||||
}
|
||||
$content_id = getFacebookWooProductContentId( $product_id );
|
||||
$params['content_ids'] = array_merge($params['content_ids'],$content_id);
|
||||
// contents
|
||||
if ( isDefaultWooContentIdLogic() ) {
|
||||
|
||||
// Facebook for WooCommerce plugin does not support new Dynamic Ads parameters
|
||||
$params['contents'][] = array(
|
||||
'id' => (string) reset( $content_id ),
|
||||
'quantity' => $qty,
|
||||
//'item_price' => PixelYourSite\getWooProductPriceToDisplay( $product_id ),// remove because price need send only with currency
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $params;
|
||||
|
||||
}
|
||||
|
||||
function getWooCartParams( $context = 'cart' ) {
|
||||
|
||||
$params['content_type'] = 'product';
|
||||
|
||||
$content_ids = array();
|
||||
$content_names = array();
|
||||
$content_categories = array();
|
||||
$tags = array();
|
||||
$contents = array();
|
||||
|
||||
foreach ( WC()->cart->cart_contents as $cart_item_key => $cart_item ) {
|
||||
|
||||
$product_id = getFacebookWooCartItemId( $cart_item );
|
||||
$content_id = getFacebookWooProductContentId( $product_id );
|
||||
|
||||
$content_ids = array_merge( $content_ids, $content_id );
|
||||
|
||||
// content_name, category_name, tags
|
||||
$custom_audiences = getWooCustomAudiencesOptimizationParams( $product_id );
|
||||
|
||||
$content_names[] = $custom_audiences['content_name'];
|
||||
$content_categories[] = $custom_audiences['category_name'];
|
||||
|
||||
$cart_item_tags = PixelYourSite\getObjectTerms( 'product_tag', $product_id );
|
||||
$tags = array_merge( $tags, $cart_item_tags );
|
||||
|
||||
// raw product id
|
||||
$_product_id = empty( $cart_item['variation_id'] ) ? $cart_item['product_id'] : $cart_item['variation_id'];
|
||||
|
||||
// contents
|
||||
$contents[] = array(
|
||||
'id' => (string) reset( $content_id ),
|
||||
'quantity' => $cart_item['quantity'],
|
||||
//'item_price' => PixelYourSite\getWooProductPriceToDisplay( $_product_id ),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
$params['content_ids'] = ( $content_ids );
|
||||
$params['content_name'] = implode( ', ', $content_names );
|
||||
$params['category_name'] = implode( ', ', $content_categories );
|
||||
|
||||
// contents
|
||||
if ( isDefaultWooContentIdLogic() ) {
|
||||
|
||||
// Facebook for WooCommerce plugin does not support new Dynamic Ads parameters
|
||||
$params['contents'] = ( $contents );
|
||||
|
||||
}
|
||||
|
||||
$tags = array_unique( $tags );
|
||||
$tags = array_slice( $tags, 0, 100 );
|
||||
$params['tags'] = implode( ', ', $tags );
|
||||
|
||||
if ( $context == 'InitiateCheckout' ) {
|
||||
|
||||
$params['num_items'] = WC()->cart->get_cart_contents_count();
|
||||
|
||||
$value_enabled_option = 'woo_initiate_checkout_value_enabled';
|
||||
$value_option_option = 'woo_initiate_checkout_value_option';
|
||||
$value_global_option = 'woo_initiate_checkout_value_global';
|
||||
|
||||
$params['subtotal'] = PixelYourSite\getWooCartSubtotal();
|
||||
|
||||
} else { // AddToCart
|
||||
|
||||
$value_enabled_option = 'woo_add_to_cart_value_enabled';
|
||||
$value_option_option = 'woo_add_to_cart_value_option';
|
||||
$value_global_option = 'woo_add_to_cart_value_global';
|
||||
|
||||
}
|
||||
|
||||
if ( PixelYourSite\PYS()->getOption( $value_enabled_option ) ) {
|
||||
|
||||
$value_option = PixelYourSite\PYS()->getOption( $value_option_option );
|
||||
$global_value = PixelYourSite\PYS()->getOption( $value_global_option, 0 );
|
||||
|
||||
$params['value'] = PixelYourSite\getWooEventValueCart( $value_option, $global_value );
|
||||
$params['currency'] = get_woocommerce_currency();
|
||||
|
||||
}
|
||||
|
||||
return $params;
|
||||
|
||||
}
|
||||
|
||||
function isFacebookForWooCommerceActive() {
|
||||
return class_exists( 'WC_Facebookcommerce' );
|
||||
}
|
||||
|
||||
function isDefaultWooContentIdLogic() {
|
||||
return ! isFacebookForWooCommerceActive() || PixelYourSite\Facebook()->getOption( 'woo_content_id_logic' ) != 'facebook_for_woocommerce';
|
||||
}
|
||||
|
||||
/**
|
||||
* EASY DIGITAL DOWNLOADS
|
||||
*/
|
||||
|
||||
function getFacebookEddDownloadContentId( $download_id ) {
|
||||
|
||||
if ( PixelYourSite\PYS()->getOption( 'edd_content_id' ) == 'download_sku' ) {
|
||||
$content_id = get_post_meta( $download_id, 'edd_sku', true );
|
||||
} else {
|
||||
$content_id = $download_id;
|
||||
}
|
||||
|
||||
$prefix = PixelYourSite\PYS()->getOption( 'edd_content_id_prefix' );
|
||||
$suffix = PixelYourSite\PYS()->getOption( 'edd_content_id_suffix' );
|
||||
|
||||
return $prefix . $content_id . $suffix;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds "content_name" and "category_name" params
|
||||
*/
|
||||
function getEddCustomAudiencesOptimizationParams( $post_id ) {
|
||||
|
||||
$post = get_post( $post_id );
|
||||
|
||||
$params = array(
|
||||
'content_name' => '',
|
||||
'category_name' => '',
|
||||
);
|
||||
|
||||
if ( ! $post ) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
$params['content_name'] = $post->post_title;
|
||||
$params['category_name'] = implode( ', ', PixelYourSite\getObjectTerms( 'download_category', $post_id ) );
|
||||
|
||||
return $params;
|
||||
|
||||
}
|
||||
|
||||
function getFDPViewContentEventParams() {
|
||||
$tagsArray = wp_get_post_tags();
|
||||
$catArray = get_the_category();
|
||||
|
||||
$tags = "";
|
||||
if(is_array($tagsArray)) {
|
||||
$tags = implode(", ",$tagsArray);
|
||||
}
|
||||
|
||||
$func = function($value) {
|
||||
return $value->cat_name;
|
||||
};
|
||||
$catArray = array_map($func,$catArray);
|
||||
$categories = implode(", ",$catArray);
|
||||
|
||||
|
||||
$params = array(
|
||||
'content_name' => get_the_title(),
|
||||
'content_ids' => get_the_ID(),
|
||||
'tags' => $tags,
|
||||
'categories' => $categories
|
||||
);
|
||||
|
||||
|
||||
return $params;
|
||||
}
|
||||
|
||||
function getFDPViewCategoryEventParams() {
|
||||
global $wp_query;
|
||||
$func = function($value) {
|
||||
return $value->ID;
|
||||
};
|
||||
$ids = array_map($func,$wp_query->posts);
|
||||
|
||||
|
||||
$params = array(
|
||||
'content_name' => single_term_title('', 0),
|
||||
'content_ids' => ($ids)
|
||||
);
|
||||
|
||||
return $params;
|
||||
}
|
||||
|
||||
function getFDPAddToCartEventParams() {
|
||||
$tagsArray = wp_get_post_tags();
|
||||
$catArray = get_the_category();
|
||||
|
||||
$tags = "";
|
||||
if(is_array($tagsArray)) {
|
||||
$tags = implode(", ",$tagsArray);
|
||||
}
|
||||
|
||||
$func = function($value) {
|
||||
return $value->cat_name;
|
||||
};
|
||||
$catArray = array_map($func,$catArray);
|
||||
$categories = implode(", ",$catArray);
|
||||
|
||||
|
||||
$params = array(
|
||||
'content_name' => get_the_title(),
|
||||
'content_ids' => get_the_ID(),
|
||||
'tags' => $tags,
|
||||
'categories' => $categories,
|
||||
'value' => 0
|
||||
);
|
||||
|
||||
|
||||
return $params;
|
||||
}
|
||||
|
||||
function getFDPPurchaseEventParams() {
|
||||
$tagsArray = wp_get_post_tags();
|
||||
$catArray = get_the_category();
|
||||
|
||||
$tags = "";
|
||||
if(is_array($tagsArray)) {
|
||||
$tags = implode(", ",$tagsArray);
|
||||
}
|
||||
|
||||
$func = function($value) {
|
||||
return $value->cat_name;
|
||||
};
|
||||
$catArray = array_map($func,$catArray);
|
||||
$categories = implode(", ",$catArray);
|
||||
|
||||
|
||||
$params = array(
|
||||
'content_name' => get_the_title(),
|
||||
'content_ids' => get_the_ID(),
|
||||
'tags' => $tags,
|
||||
'categories' => $categories,
|
||||
'value' => 0
|
||||
);
|
||||
|
||||
|
||||
return $params;
|
||||
}
|
||||
|
||||
function getCompleteRegistrationOrderParams() {
|
||||
$params = array();
|
||||
$order_key = sanitize_key( $_REQUEST['key']);
|
||||
$order_id = (int) wc_get_order_id_by_order_key( $order_key );
|
||||
$order = new \WC_Order( $order_id );
|
||||
|
||||
$value_option = PixelYourSite\Facebook()->getOption( 'woo_complete_registration_custom_value' );
|
||||
$global_value = PixelYourSite\Facebook()->getOption( 'woo_complete_registration_global_value', 0 );
|
||||
$percents_value = PixelYourSite\Facebook()->getOption( 'woo_complete_registration_percent_value', 100 );
|
||||
|
||||
$params['value'] = PixelYourSite\getWooEventValueOrder( $value_option, $order, $global_value, $percents_value );
|
||||
$params['currency'] = get_woocommerce_currency();
|
||||
return $params;
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
{
|
||||
"enabled": true,
|
||||
"pixel_id": "",
|
||||
"advanced_matching_enabled": false,
|
||||
"remove_metadata": false,
|
||||
|
||||
"general_event_enabled": true,
|
||||
"comment_event_enabled": true,
|
||||
"download_event_enabled": true,
|
||||
"form_event_enabled": true,
|
||||
|
||||
"woo_variable_as_simple": false,
|
||||
"woo_content_id": "product_id",
|
||||
"woo_content_id_prefix": "",
|
||||
"woo_content_id_suffix": "",
|
||||
"woo_content_id_logic": "default",
|
||||
"woo_purchase_enabled": true,
|
||||
"woo_initiate_checkout_enabled": true,
|
||||
"woo_remove_from_cart_enabled": true,
|
||||
"woo_add_to_cart_enabled": true,
|
||||
"woo_view_content_enabled": true,
|
||||
"woo_view_category_enabled": true,
|
||||
|
||||
"edd_content_id": "download_id",
|
||||
"edd_content_id_prefix": "",
|
||||
"edd_content_id_suffix": "",
|
||||
"edd_purchase_enabled": true,
|
||||
"edd_initiate_checkout_enabled": true,
|
||||
"edd_remove_from_cart_enabled": true,
|
||||
"edd_add_to_cart_enabled": true,
|
||||
"edd_view_content_enabled": true,
|
||||
"edd_view_category_enabled": true,
|
||||
|
||||
|
||||
"fdp_content_type" : "product",
|
||||
"fdp_view_content_enabled": false,
|
||||
"fdp_view_category_enabled": false,
|
||||
"fdp_add_to_cart_enabled": false,
|
||||
"fdp_add_to_cart_event_fire_scroll": "50",
|
||||
"fdp_purchase_enabled": false,
|
||||
"fdp_purchase_event_fire" : "scroll_pos",
|
||||
"fdp_purchase_event_fire_scroll": "90",
|
||||
"fdp_purchase_event_fire_css": "",
|
||||
|
||||
"fdp_pixel_id": "",
|
||||
"fdp_use_own_pixel_id": false,
|
||||
"fdp_currency" : "USD",
|
||||
"fdp_add_to_cart_value" : "0",
|
||||
"fdp_purchase_value" : "0",
|
||||
|
||||
"use_server_api": false,
|
||||
"server_event_use_ajax": true,
|
||||
"server_access_api_token": "",
|
||||
"test_api_event_code": "",
|
||||
"test_api_event_code_expiration_at": "",
|
||||
|
||||
"complete_registration_event_enabled" : true,
|
||||
"woo_complete_registration_fire_every_time": false,
|
||||
"woo_complete_registration_use_custom_value": true,
|
||||
"woo_complete_registration_custom_value": "price",
|
||||
"woo_complete_registration_percent_value": "",
|
||||
"woo_complete_registration_global_value": "",
|
||||
"woo_complete_registration_custom_value_old": "",
|
||||
"woo_complete_registration_send_from_server": true,
|
||||
|
||||
"verify_meta_tag": "",
|
||||
|
||||
"automatic_event_form_enabled": true,
|
||||
"automatic_event_signup_enabled": true,
|
||||
"automatic_event_login_enabled": true,
|
||||
"automatic_event_download_enabled": true,
|
||||
"automatic_event_comment_enabled": true,
|
||||
"automatic_event_scroll_enabled": true,
|
||||
"automatic_event_time_on_page_enabled": true,
|
||||
"automatic_event_search_enabled": true
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
{
|
||||
"enabled": "checkbox",
|
||||
"pixel_id": "array",
|
||||
"advanced_matching_enabled": "checkbox",
|
||||
"remove_metadata": "checkbox",
|
||||
|
||||
"general_event_enabled": "checkbox",
|
||||
"comment_event_enabled": "checkbox",
|
||||
"download_event_enabled": "checkbox",
|
||||
"form_event_enabled": "checkbox",
|
||||
|
||||
"woo_variable_as_simple": "checkbox",
|
||||
"woo_content_id": "select",
|
||||
"woo_content_id_prefix": "text",
|
||||
"woo_content_id_suffix": "text",
|
||||
"woo_content_id_logic": "radio",
|
||||
"woo_purchase_enabled": "checkbox",
|
||||
"woo_initiate_checkout_enabled": "checkbox",
|
||||
"woo_remove_from_cart_enabled": "checkbox",
|
||||
"woo_add_to_cart_enabled": "checkbox",
|
||||
"woo_view_content_enabled": "checkbox",
|
||||
"woo_view_category_enabled": "checkbox",
|
||||
|
||||
"edd_content_id": "select",
|
||||
"edd_content_id_prefix": "text",
|
||||
"edd_content_id_suffix": "text",
|
||||
"edd_purchase_enabled": "checkbox",
|
||||
"edd_initiate_checkout_enabled": "checkbox",
|
||||
"edd_remove_from_cart_enabled": "checkbox",
|
||||
"edd_add_to_cart_enabled": "checkbox",
|
||||
"edd_view_content_enabled": "checkbox",
|
||||
"edd_view_category_enabled": "checkbox",
|
||||
|
||||
"fdp_content_type" : "select",
|
||||
"fdp_view_content_enabled": "checkbox",
|
||||
"fdp_view_category_enabled": "checkbox",
|
||||
"fdp_add_to_cart_enabled": "checkbox",
|
||||
"fdp_add_to_cart_event_fire_scroll": "text",
|
||||
"fdp_purchase_enabled": "checkbox",
|
||||
"fdp_purchase_event_fire" : "select",
|
||||
"fdp_purchase_event_fire_scroll": "text",
|
||||
"fdp_purchase_event_fire_css": "text",
|
||||
|
||||
"fdp_pixel_id": "text",
|
||||
"fdp_use_own_pixel_id": "checkbox",
|
||||
"fdp_currency" : "select",
|
||||
"fdp_add_to_cart_value" : "text",
|
||||
"fdp_purchase_value" : "text",
|
||||
|
||||
"use_server_api": "checkbox",
|
||||
"server_event_use_ajax": "checkbox",
|
||||
"server_access_api_token": "array",
|
||||
"test_api_event_code": "array",
|
||||
"test_api_event_code_expiration_at": "array",
|
||||
|
||||
"complete_registration_event_enabled" : "checkbox",
|
||||
"woo_complete_registration_percent_value": "text",
|
||||
"woo_complete_registration_global_value": "text",
|
||||
"woo_complete_registration_fire_every_time": "checkbox",
|
||||
"woo_complete_registration_use_custom_value": "checkbox",
|
||||
"woo_complete_registration_custom_value": "radio",
|
||||
"woo_complete_registration_custom_value_old": "radio",
|
||||
"woo_complete_registration_send_from_server": "checkbox",
|
||||
|
||||
"verify_meta_tag": "array_textarea",
|
||||
|
||||
"automatic_event_form_enabled": "checkbox",
|
||||
"automatic_event_signup_enabled": "checkbox",
|
||||
"automatic_event_login_enabled": "checkbox",
|
||||
"automatic_event_download_enabled": "checkbox",
|
||||
"automatic_event_comment_enabled": "checkbox",
|
||||
"automatic_event_scroll_enabled": "checkbox",
|
||||
"automatic_event_time_on_page_enabled": "checkbox",
|
||||
"automatic_event_search_enabled": "checkbox"
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace PixelYourSite;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<h2 class="section-title">Facebook Settings</h2>
|
||||
|
||||
<!-- General -->
|
||||
<div class="card card-static">
|
||||
<div class="card-header">
|
||||
General
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row mb-3">
|
||||
<div class="col">
|
||||
<?php Facebook()->render_switcher_input( 'enabled' ); ?>
|
||||
<h4 class="switcher-label">Enable Meta Pixel (formerly Facebook Pixel)</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<?php Facebook()->render_switcher_input( 'advanced_matching_enabled' ); ?>
|
||||
<h4 class="switcher-label">Enable Advanced Matching</h4>
|
||||
<div class="alert alert-primary mt-3">Because of a Facebook error, when Advanced Matching is ON, Custom
|
||||
Audiences based on the pixel
|
||||
will not show the size number ("Size: -1", or "Size Unavailable"). They will still work fine for
|
||||
retargeting or Lookalike Audiences. Details <a href="https://www.pixelyoursite
|
||||
.com/facebook-audience-size-not-available" target="_blank">here</a>.</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<?php Facebook()->render_switcher_input( 'remove_metadata' ); ?>
|
||||
<h4 class="switcher-label">Remove Facebook default events</h4>
|
||||
</div>
|
||||
</div>
|
||||
<!--
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<?php Facebook()->render_switcher_input( 'send_external_id_demo',false,true ); ?>
|
||||
<h4 class="switcher-label">Send external id</h4>
|
||||
<?php renderProBadge();?>
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel">
|
||||
<div class="row">
|
||||
<div class="col text-center">
|
||||
<p class="mb-0">Fire more events and parameters and improve your ads performance.
|
||||
<br><a href="https://www.pixelyoursite.com/facebook-pixel-plugin?utm_source=pixelyoursite-free-plugin&utm_medium=plugin&utm_campaign=free-plugin-facebook-settings"
|
||||
target="_blank">Find more about the PRO Meta Pixel (formerly Facebook Pixel) implementation</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-4">
|
||||
<button class="btn btn-block btn-save">Save Settings</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
use PixelYourSite\GA\Helpers;
|
||||
|
||||
|
||||
function getCompleteRegistrationEventParamsV4() {
|
||||
if ( ! PixelYourSite\GA()->getOption( 'complete_registration_event_enabled' ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return array(
|
||||
'name' => 'sign_up',
|
||||
'data' => array(
|
||||
'content_name' => get_the_title(),
|
||||
'event_url' => \PixelYourSite\getCurrentPageUrl(true),
|
||||
'method' => \PixelYourSite\getUserRoles(),
|
||||
'non_interaction' => PixelYourSite\GA()->getOption( 'complete_registration_event_non_interactive' ),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace PixelYourSite\GA\Helpers;
|
||||
|
||||
use PixelYourSite;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Render Cross Domain Domain text field
|
||||
*
|
||||
* @param int $index
|
||||
*/
|
||||
function renderCrossDomainDomain( $index = 0 ) {
|
||||
|
||||
$slug = PixelYourSite\GA()->getSlug();
|
||||
|
||||
$attr_name = "pys[$slug][cross_domain_domains][]";
|
||||
$attr_id = 'pys_' . $slug . '_cross_domain_domains_' . $index;
|
||||
|
||||
$values = (array) PixelYourSite\GA()->getOption( 'cross_domain_domains' );
|
||||
$attr_value = isset( $values[ $index ] ) ? $values[ $index ] : null;
|
||||
|
||||
?>
|
||||
|
||||
<input type="text" name="<?php esc_attr_e( $attr_name ); ?>"
|
||||
id="<?php esc_attr_e( $attr_id ); ?>"
|
||||
value="<?php esc_attr_e( $attr_value ); ?>"
|
||||
placeholder="Enter domain"
|
||||
class="form-control">
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
function getWooProductContentId( $product_id ) {
|
||||
|
||||
if ( PixelYourSite\GA()->getOption( 'woo_content_id' ) == 'product_sku' ) {
|
||||
$content_id = get_post_meta( $product_id, '_sku', true );
|
||||
} else {
|
||||
$content_id = $product_id;
|
||||
}
|
||||
|
||||
$prefix = PixelYourSite\GA()->getOption( 'woo_content_id_prefix' );
|
||||
$suffix = PixelYourSite\GA()->getOption( 'woo_content_id_suffix' );
|
||||
|
||||
$value = $prefix . $content_id . $suffix;
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
function getWooCartItemId( $item ) {
|
||||
|
||||
if ( ! PixelYourSite\GA()->getOption( 'woo_variable_as_simple' ) && isset( $item['variation_id'] ) && $item['variation_id'] !== 0 ) {
|
||||
$product_id = $item['variation_id'];
|
||||
} else {
|
||||
$product_id = $item['product_id'];
|
||||
}
|
||||
|
||||
return $product_id;
|
||||
}
|
||||
|
||||
/*
|
||||
* EASY DIGITAL DOWNLOADS
|
||||
*/
|
||||
|
||||
function getEddDownloadContentId( $download_id )
|
||||
{
|
||||
|
||||
if (PixelYourSite\GA()->getOption('edd_content_id') == 'download_sku') {
|
||||
$content_id = get_post_meta($download_id, 'edd_sku', true);
|
||||
} else {
|
||||
$content_id = $download_id;
|
||||
}
|
||||
|
||||
$prefix = PixelYourSite\GA()->getOption('edd_content_id_prefix');
|
||||
$suffix = PixelYourSite\GA()->getOption('edd_content_id_suffix');
|
||||
|
||||
return $prefix . $content_id . $suffix;
|
||||
}
|
||||
1107
wp-content/plugins/pixelyoursite/modules/google_analytics/ga.php
Normal file
1107
wp-content/plugins/pixelyoursite/modules/google_analytics/ga.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,75 @@
|
||||
{
|
||||
"enabled": true,
|
||||
"is_enable_debug_mode": "",
|
||||
"tracking_id": "",
|
||||
"enhance_link_attribution": false,
|
||||
"anonimize_ip": false,
|
||||
|
||||
"cross_domain_enabled": false,
|
||||
"cross_domain_accept_incoming": false,
|
||||
"cross_domain_domains": [],
|
||||
|
||||
"search_event_non_interactive": true,
|
||||
"comment_event_enabled": true,
|
||||
"comment_event_non_interactive": false,
|
||||
"download_event_enabled": true,
|
||||
"download_event_non_interactive": false,
|
||||
"form_event_enabled": true,
|
||||
"form_event_non_interactive": false,
|
||||
|
||||
"woo_variable_as_simple": false,
|
||||
"woo_content_id": "product_id",
|
||||
"woo_content_id_prefix": "",
|
||||
"woo_content_id_suffix": "",
|
||||
|
||||
"woo_purchase_enabled": true,
|
||||
"woo_purchase_non_interactive": true,
|
||||
"woo_initiate_checkout_enabled": true,
|
||||
"woo_initiate_checkout_non_interactive": true,
|
||||
"woo_remove_from_cart_enabled": true,
|
||||
"woo_remove_from_cart_non_interactive": false,
|
||||
"woo_add_to_cart_enabled": true,
|
||||
"woo_add_to_cart_non_interactive": false,
|
||||
"woo_view_content_enabled": true,
|
||||
"woo_view_content_non_interactive": true,
|
||||
"woo_view_category_enabled": true,
|
||||
"woo_view_category_non_interactive": true,
|
||||
|
||||
"edd_content_id": "download_id",
|
||||
"edd_content_id_prefix": "",
|
||||
"edd_content_id_suffix": "",
|
||||
|
||||
"edd_purchase_enabled": true,
|
||||
"edd_purchase_non_interactive": true,
|
||||
"edd_initiate_checkout_enabled": true,
|
||||
"edd_initiate_checkout_non_interactive": true,
|
||||
"edd_remove_from_cart_enabled": true,
|
||||
"edd_remove_from_cart_non_interactive": false,
|
||||
"edd_add_to_cart_enabled": true,
|
||||
"edd_add_to_cart_non_interactive": false,
|
||||
"edd_view_content_enabled": true,
|
||||
"edd_view_content_non_interactive": true,
|
||||
"edd_view_category_enabled": true,
|
||||
"edd_view_category_non_interactive": true,
|
||||
|
||||
"disable_advertising_features": false,
|
||||
"disable_advertising_personalization": false,
|
||||
|
||||
"automatic_event_form_enabled": true,
|
||||
"automatic_event_signup_enabled": true,
|
||||
"automatic_event_login_enabled": true,
|
||||
"automatic_event_download_enabled": true,
|
||||
"automatic_event_comment_enabled": true,
|
||||
"automatic_event_scroll_enabled": true,
|
||||
"automatic_event_time_on_page_enabled": true,
|
||||
"automatic_event_search_enabled": true,
|
||||
|
||||
"automatic_event_form_non_interactive_enabled": false,
|
||||
"automatic_event_signup_non_interactive_enabled": false,
|
||||
"automatic_event_login_non_interactive_enabled": false,
|
||||
"automatic_event_download_non_interactive_enabled": false,
|
||||
"automatic_event_comment_non_interactive_enabled": false,
|
||||
"automatic_event_scroll_non_interactive_enabled": false,
|
||||
"automatic_event_time_on_page_non_interactive_enabled": false,
|
||||
"automatic_event_search_non_interactive_enabled": false
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
{
|
||||
"enabled": "checkbox",
|
||||
"is_enable_debug_mode": "array",
|
||||
"tracking_id": "array",
|
||||
"enhance_link_attribution": "checkbox",
|
||||
"anonimize_ip": "checkbox",
|
||||
|
||||
"cross_domain_enabled": "checkbox",
|
||||
"cross_domain_accept_incoming": "checkbox",
|
||||
"cross_domain_domains": "array",
|
||||
|
||||
"search_event_non_interactive": "checkbox",
|
||||
"comment_event_enabled": "checkbox",
|
||||
"comment_event_non_interactive": "checkbox",
|
||||
"download_event_enabled": "checkbox",
|
||||
"download_event_non_interactive": "checkbox",
|
||||
"form_event_enabled": "checkbox",
|
||||
"form_event_non_interactive": "checkbox",
|
||||
|
||||
"woo_variable_as_simple": "checkbox",
|
||||
"woo_content_id": "select",
|
||||
"woo_content_id_prefix": "text",
|
||||
"woo_content_id_suffix": "text",
|
||||
|
||||
"woo_purchase_enabled": "checkbox",
|
||||
"woo_purchase_non_interactive": "checkbox",
|
||||
"woo_initiate_checkout_enabled": "checkbox",
|
||||
"woo_initiate_checkout_non_interactive": "checkbox",
|
||||
"woo_remove_from_cart_enabled": "checkbox",
|
||||
"woo_remove_from_cart_non_interactive": "checkbox",
|
||||
"woo_add_to_cart_enabled": "checkbox",
|
||||
"woo_add_to_cart_non_interactive": "checkbox",
|
||||
"woo_view_content_enabled": "checkbox",
|
||||
"woo_view_content_non_interactive": "checkbox",
|
||||
"woo_view_category_enabled": "checkbox",
|
||||
"woo_view_category_non_interactive": "checkbox",
|
||||
|
||||
"edd_content_id": "select",
|
||||
"edd_content_id_prefix": "text",
|
||||
"edd_content_id_suffix": "text",
|
||||
|
||||
"edd_purchase_enabled": "checkbox",
|
||||
"edd_purchase_non_interactive": "checkbox",
|
||||
"edd_initiate_checkout_enabled": "checkbox",
|
||||
"edd_initiate_checkout_non_interactive": "checkbox",
|
||||
"edd_remove_from_cart_enabled": "checkbox",
|
||||
"edd_remove_from_cart_non_interactive": "checkbox",
|
||||
"edd_add_to_cart_enabled": "checkbox",
|
||||
"edd_add_to_cart_non_interactive": "checkbox",
|
||||
"edd_view_content_enabled": "checkbox",
|
||||
"edd_view_content_non_interactive": "checkbox",
|
||||
"edd_view_category_enabled": "checkbox",
|
||||
"edd_view_category_non_interactive": "checkbox",
|
||||
|
||||
"disable_advertising_features": "checkbox",
|
||||
"disable_advertising_personalization": "checkbox",
|
||||
|
||||
"automatic_event_form_enabled": "checkbox",
|
||||
"automatic_event_signup_enabled": "checkbox",
|
||||
"automatic_event_login_enabled": "checkbox",
|
||||
"automatic_event_download_enabled": "checkbox",
|
||||
"automatic_event_comment_enabled": "checkbox",
|
||||
"automatic_event_scroll_enabled": "checkbox",
|
||||
"automatic_event_time_on_page_enabled": "checkbox",
|
||||
"automatic_event_search_enabled": "checkbox",
|
||||
|
||||
"automatic_event_form_non_interactive_enabled": "checkbox",
|
||||
"automatic_event_signup_non_interactive_enabled": "checkbox",
|
||||
"automatic_event_login_non_interactive_enabled": "checkbox",
|
||||
"automatic_event_download_non_interactive_enabled": "checkbox",
|
||||
"automatic_event_comment_non_interactive_enabled": "checkbox",
|
||||
"automatic_event_scroll_non_interactive_enabled": "checkbox",
|
||||
"automatic_event_time_on_page_non_interactive_enabled": "checkbox",
|
||||
"automatic_event_search_non_interactive_enabled": "checkbox"
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
<?php
|
||||
|
||||
namespace PixelYourSite;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
use PixelYourSite\GA\Helpers;
|
||||
|
||||
?>
|
||||
|
||||
<h2 class="section-title">Google Analytics Settings</h2>
|
||||
|
||||
<!-- General -->
|
||||
<div class="card card-static">
|
||||
<div class="card-header">
|
||||
General
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row mb-3">
|
||||
<div class="col">
|
||||
<?php GA()->render_switcher_input( 'enabled' ); ?>
|
||||
<h4 class="switcher-label">Enable Google Analytics</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<?php GA()->render_switcher_input( 'enhance_link_attribution' ); ?>
|
||||
<h4 class="switcher-label">Enable Enhance Link Attribution</h4>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<?php GA()->render_switcher_input( 'disable_advertising_features' ); ?>
|
||||
<h4 class="switcher-label">Disable all advertising features</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<?php GA()->render_switcher_input( 'disable_advertising_personalization' ); ?>
|
||||
<h4 class="switcher-label">Disable advertising personalization</h4>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<?php GA()->render_switcher_input( 'anonimize_ip' ); ?>
|
||||
<h4 class="switcher-label">Anonimize IP</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-11 col-offset-left">
|
||||
<div class="indicator indicator-off">OFF</div>
|
||||
<h4 class="indicator-label">Tracking Custom Dimensions</h4>
|
||||
</div>
|
||||
<div class="col-1">
|
||||
<?php renderExternalHelpIcon( 'https://www.pixelyoursite.com/documentation/google-analytics-custom-dimensions?utm_source=pixelyoursite-free-plugin&utm_medium=plugin&utm_campaign=free-plugin-analytics-settings' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Google Optimize -->
|
||||
<div class="card card-static">
|
||||
<div class="card-header">
|
||||
Google Optimize <?php renderProBadge( 'https://www.pixelyoursite.com/google-analytics?utm_source=pys-free-plugin&utm_medium=pro-badge&utm_campaign=pro-feature' ); ?>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row mb-3">
|
||||
<div class="col">
|
||||
<?php renderDummySwitcher(); ?>
|
||||
<h4 class="switcher-label">Enable Google Optimize</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col">
|
||||
<?php renderDummyTextInput('Enter Optimize ID'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row ">
|
||||
<div class="col">
|
||||
<p>
|
||||
Learn how to configure Google Optimize:
|
||||
<a href="https://www.youtube.com/watch?v=a5jPcLbdgy0" target="_blank">watch
|
||||
video</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Cross-Domain Tracking -->
|
||||
<!-- @link: https://developers.google.com/analytics/devguides/collection/gtagjs/cross-domain -->
|
||||
<div class="card card-static">
|
||||
<div class="card-header">
|
||||
Cross-Domain Tracking
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row mb-3">
|
||||
<div class="col-11">
|
||||
<?php GA()->render_switcher_input( 'cross_domain_enabled' ); ?>
|
||||
<h4 class="switcher-label">Enable Cross-Domain Tracking</h4>
|
||||
</div>
|
||||
<div class="col-1">
|
||||
<?php renderPopoverButton( 'ga_cross_domain_tracking' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col col-offset-left">
|
||||
<?php GA()->render_switcher_input( 'cross_domain_accept_incoming' ); ?>
|
||||
<h4 class="switcher-label">Accept incoming</h4>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mt-3">
|
||||
<div class="col-5 col-offset-left">
|
||||
<?php Helpers\renderCrossDomainDomain( 0 ); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php foreach ( GA()->getOption('cross_domain_domains') as $index => $domain ) : ?>
|
||||
|
||||
<?php
|
||||
|
||||
if ( $index === 0 ) {
|
||||
continue; // skip default ID
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div class="row mt-3">
|
||||
<div class="col-5 col-offset-left">
|
||||
<?php Helpers\renderCrossDomainDomain( $index ); ?>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<button type="button" class="btn btn-sm remove-row">
|
||||
<i class="fa fa-trash-o" aria-hidden="true"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php endforeach; ?>
|
||||
|
||||
<div class="row mt-3" id="pys_ga_cross_domain_domain" style="display: none;">
|
||||
<div class="col-5 col-offset-left">
|
||||
<input type="text" name="" id="" value="" placeholder="Enter domain" class="form-control">
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<button type="button" class="btn btn-sm remove-row">
|
||||
<i class="fa fa-trash-o" aria-hidden="true"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mt-3">
|
||||
<div class="col-5 col-offset-left">
|
||||
<button class="btn btn-sm btn-block btn-primary" type="button"
|
||||
id="pys_ga_add_cross_domain_domain">
|
||||
Add Extra Domain
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel">
|
||||
<div class="row">
|
||||
<div class="col text-center">
|
||||
<p class="mb-0">Track more actions with the PRO version.
|
||||
<br><a href="https://www.pixelyoursite.com/google-analytics?utm_source=pixelyoursite-free-plugin&utm_medium=plugin&utm_campaign=free-plugin-analytics-settings"
|
||||
target="_blank">Find more about the Google Analytics pro implementation</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-4">
|
||||
<button class="btn btn-block btn-save">Save Settings</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="application/javascript">
|
||||
jQuery(document).ready(function ($) {
|
||||
|
||||
$('#pys_ga_add_cross_domain_domain').click(function (e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
var $row = $('#pys_ga_cross_domain_domain').clone()
|
||||
.insertBefore('#pys_ga_cross_domain_domain')
|
||||
.attr('id', '')
|
||||
.css('display', 'flex');
|
||||
|
||||
$('input[type="text"]', $row)
|
||||
.attr('name', 'pys[ga][cross_domain_domains][]');
|
||||
|
||||
});
|
||||
|
||||
$(document).on('click', '.remove-row', function () {
|
||||
$(this).closest('.row').remove();
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,292 @@
|
||||
<?php
|
||||
|
||||
namespace PixelYourSite;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
class HeadFooter extends Settings {
|
||||
|
||||
private static $_instance;
|
||||
|
||||
private $is_mobile;
|
||||
|
||||
public static function instance() {
|
||||
|
||||
if ( is_null( self::$_instance ) ) {
|
||||
self::$_instance = new self();
|
||||
}
|
||||
|
||||
return self::$_instance;
|
||||
|
||||
}
|
||||
|
||||
public function __construct() {
|
||||
|
||||
parent::__construct( 'head_footer' );
|
||||
|
||||
$this->locateOptions(
|
||||
PYS_FREE_PATH . '/modules/head_footer/options_fields.json',
|
||||
PYS_FREE_PATH . '/modules/head_footer/options_defaults.json'
|
||||
);
|
||||
|
||||
add_action( 'pys_register_plugins', function( $core ) {
|
||||
/** @var PYS $core */
|
||||
$core->registerPlugin( $this );
|
||||
} );
|
||||
|
||||
if ( $this->getOption( 'enabled' ) ) {
|
||||
add_action( 'add_meta_boxes', array( $this, 'register_meta_box' ) );
|
||||
add_action( 'save_post', array( $this, 'save_meta_box' ) );
|
||||
}
|
||||
|
||||
if ( $this->getOption( 'enabled' ) ) {
|
||||
add_action( 'template_redirect', array( $this, 'output_scripts' ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Register meta box for each public post type.
|
||||
*/
|
||||
public function register_meta_box() {
|
||||
|
||||
if ( current_user_can( 'manage_pys' ) ) {
|
||||
|
||||
$screens = get_post_types( array( 'public' => true ) );
|
||||
|
||||
foreach ( $screens as $screen ) {
|
||||
add_meta_box( 'pys-head-footer', 'PixelYourSite Head & Footer Scripts',
|
||||
array( $this, 'render_meta_box' ),
|
||||
$screen );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function render_meta_box() {
|
||||
include 'views/html-meta-box.php';
|
||||
}
|
||||
|
||||
public function save_meta_box( $post_id ) {
|
||||
|
||||
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! current_user_can( 'manage_pys' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! isset( $_POST['pys_head_footer'] ) ) {
|
||||
// delete_post_meta( $post_id, '_pys_head_footer' );
|
||||
return;
|
||||
}
|
||||
|
||||
$data = $_POST['pys_head_footer'];
|
||||
|
||||
$meta = array(
|
||||
'disable_global' => isset( $data['disable_global'] ) ? true : false,
|
||||
'head_any' => isset( $data['head_any'] ) ? trim( $data['head_any'] ) : '',
|
||||
'head_desktop' => isset( $data['head_desktop'] ) ? trim( $data['head_desktop'] ) : '',
|
||||
'head_mobile' => isset( $data['head_mobile'] ) ? trim( $data['head_mobile'] ) : '',
|
||||
'footer_any' => isset( $data['footer_any'] ) ? trim( $data['footer_any'] ) : '',
|
||||
'footer_desktop' => isset( $data['footer_desktop'] ) ? trim( $data['footer_desktop'] ) : '',
|
||||
'footer_mobile' => isset( $data['footer_mobile'] ) ? trim( $data['footer_mobile'] ) : '',
|
||||
);
|
||||
|
||||
update_post_meta( $post_id, '_pys_head_footer', $meta );
|
||||
|
||||
}
|
||||
|
||||
public function output_scripts() {
|
||||
global $post;
|
||||
|
||||
if ( is_admin() || defined( 'DOING_AJAX' ) || defined( 'DOING_CRON' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->is_mobile = wp_is_mobile();
|
||||
|
||||
/**
|
||||
* WooCommerce Order Received page
|
||||
*/
|
||||
|
||||
if ( isWooCommerceActive() && is_order_received_page() ) {
|
||||
add_action( 'wp_head', array( $this, 'output_head_woo_order_received' ) );
|
||||
add_action( 'wp_footer', array( $this, 'output_footer_woo_order_received' ) );
|
||||
}
|
||||
|
||||
$disabled_by_woo = isWooCommerceActive() && is_order_received_page() &&
|
||||
$this->getOption( 'woo_order_received_disable_global' );
|
||||
|
||||
if ( $disabled_by_woo ) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Single Post
|
||||
*/
|
||||
|
||||
if ( is_singular() && $post ) {
|
||||
$post_meta = get_post_meta( $post->ID, '_pys_head_footer', true );
|
||||
} else {
|
||||
$post_meta = array();
|
||||
}
|
||||
|
||||
if ( ! empty( $post_meta ) ) {
|
||||
add_action( 'wp_head', array( $this, 'output_head_post' ) );
|
||||
add_action( 'wp_footer', array( $this, 'output_footer_post' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Global
|
||||
*/
|
||||
|
||||
$disabled_by_post = ! empty( $post_meta ) && isset($post_meta['disable_global']) && $post_meta['disable_global'];
|
||||
|
||||
if ( ! $disabled_by_post ) {
|
||||
add_action( 'wp_head', array( $this, 'output_head_global' ) );
|
||||
add_action( 'wp_footer', array( $this, 'output_footer_global' ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function output_head_woo_order_received() {
|
||||
|
||||
$scripts_any = $this->getOption( 'woo_order_received_head_any' );
|
||||
|
||||
if ( $scripts_any ) {
|
||||
echo "\r\n{$scripts_any}\r\n";
|
||||
}
|
||||
|
||||
if ( $this->is_mobile ) {
|
||||
$scripts_by_device = $this->getOption( 'woo_order_received_head_mobile' );
|
||||
} else {
|
||||
$scripts_by_device = $this->getOption( 'woo_order_received_head_desktop' );
|
||||
}
|
||||
|
||||
if ( $scripts_by_device ) {
|
||||
echo "\r\n{$scripts_by_device}\r\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function output_footer_woo_order_received() {
|
||||
|
||||
$scripts_any = $this->getOption( 'woo_order_received_footer_any' );
|
||||
|
||||
if ( $scripts_any ) {
|
||||
echo "\r\n{$scripts_any}\r\n";
|
||||
}
|
||||
|
||||
if ( $this->is_mobile ) {
|
||||
$scripts_by_device = $this->getOption( 'woo_order_received_footer_mobile' );
|
||||
} else {
|
||||
$scripts_by_device = $this->getOption( 'woo_order_received_footer_desktop' );
|
||||
}
|
||||
|
||||
if ( $scripts_by_device ) {
|
||||
echo "\r\n{$scripts_by_device}\r\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function output_head_global() {
|
||||
|
||||
$scripts_any = $this->getOption( 'head_any' );
|
||||
|
||||
if ( $scripts_any ) {
|
||||
echo "\r\n{$scripts_any}\r\n";
|
||||
}
|
||||
|
||||
if ( $this->is_mobile ) {
|
||||
$scripts_by_device = $this->getOption( 'head_mobile' );
|
||||
} else {
|
||||
$scripts_by_device = $this->getOption( 'head_desktop' );
|
||||
}
|
||||
|
||||
if ( $scripts_by_device ) {
|
||||
echo "\r\n{$scripts_by_device}\r\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function output_footer_global() {
|
||||
|
||||
$scripts_any = $this->getOption( 'footer_any' );
|
||||
|
||||
if ( $scripts_any ) {
|
||||
echo "\r\n{$scripts_any}\r\n";
|
||||
}
|
||||
|
||||
if ( $this->is_mobile ) {
|
||||
$scripts_by_device = $this->getOption( 'footer_mobile' );
|
||||
} else {
|
||||
$scripts_by_device = $this->getOption( 'footer_desktop' );
|
||||
}
|
||||
|
||||
if ( $scripts_by_device ) {
|
||||
echo "\r\n{$scripts_by_device}\r\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function output_head_post() {
|
||||
global $post;
|
||||
|
||||
$post_meta = get_post_meta( $post->ID, '_pys_head_footer', true );
|
||||
|
||||
$scripts_any = isset( $post_meta['head_any'] ) ? $post_meta['head_any'] : false;
|
||||
|
||||
if ( $scripts_any ) {
|
||||
echo "\r\n{$scripts_any}\r\n";
|
||||
}
|
||||
|
||||
if ( $this->is_mobile ) {
|
||||
$scripts_by_device = isset( $post_meta['head_mobile'] ) ? $post_meta['head_mobile'] : false;
|
||||
} else {
|
||||
$scripts_by_device = isset( $post_meta['head_desktop'] ) ? $post_meta['head_desktop'] : false;
|
||||
}
|
||||
|
||||
if ( $scripts_by_device ) {
|
||||
echo "\r\n{$scripts_by_device}\r\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function output_footer_post() {
|
||||
global $post;
|
||||
|
||||
$post_meta = get_post_meta( $post->ID, '_pys_head_footer', true );
|
||||
|
||||
$scripts_any = isset( $post_meta['footer_any'] ) ? $post_meta['footer_any'] : false;
|
||||
|
||||
if ( $scripts_any ) {
|
||||
echo "\r\n{$scripts_any}\r\n";
|
||||
}
|
||||
|
||||
if ( $this->is_mobile ) {
|
||||
$scripts_by_device = isset( $post_meta['footer_mobile'] ) ? $post_meta['footer_mobile'] : false;
|
||||
} else {
|
||||
$scripts_by_device = isset( $post_meta['footer_desktop'] ) ? $post_meta['footer_desktop'] : false;
|
||||
}
|
||||
|
||||
if ( $scripts_by_device ) {
|
||||
echo "\r\n{$scripts_by_device}\r\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HeadFooter
|
||||
*/
|
||||
function HeadFooter() {
|
||||
return HeadFooter::instance();
|
||||
}
|
||||
|
||||
HeadFooter();
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"enabled": true,
|
||||
"head_any" : "",
|
||||
"head_desktop" : "",
|
||||
"head_mobile" : "",
|
||||
"footer_any" : "",
|
||||
"footer_desktop" : "",
|
||||
"footer_mobile" : "",
|
||||
"woo_order_received_disable_global" : false,
|
||||
"woo_order_received_head_any" : "",
|
||||
"woo_order_received_head_desktop" : "",
|
||||
"woo_order_received_head_mobile" : "",
|
||||
"woo_order_received_footer_any" : "",
|
||||
"woo_order_received_footer_desktop" : "",
|
||||
"woo_order_received_footer_mobile" : ""
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"enabled": "checkbox",
|
||||
"head_any": "textarea",
|
||||
"head_desktop": "textarea",
|
||||
"head_mobile": "textarea",
|
||||
"footer_any": "textarea",
|
||||
"footer_desktop": "textarea",
|
||||
"footer_mobile": "textarea",
|
||||
"woo_order_received_disable_global": "checkbox",
|
||||
"woo_order_received_head_any": "textarea",
|
||||
"woo_order_received_head_desktop": "textarea",
|
||||
"woo_order_received_head_mobile": "textarea",
|
||||
"woo_order_received_footer_any": "textarea",
|
||||
"woo_order_received_footer_desktop": "textarea",
|
||||
"woo_order_received_footer_mobile": "textarea"
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
<?php
|
||||
|
||||
namespace PixelYourSite;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<h2 class="section-title">Head and Footer Settings</h2>
|
||||
|
||||
<!-- General -->
|
||||
<div class="card card-static">
|
||||
<div class="card-header">
|
||||
General
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<?php HeadFooter()->render_switcher_input( 'enabled' ); ?>
|
||||
<h4 class="switcher-label">Enable Head and Footer</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Header Scripts -->
|
||||
<div class="card card-static">
|
||||
<div class="card-header">
|
||||
Head Scripts
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row form-group">
|
||||
<div class="col">
|
||||
<h4 class="label">Any device type:</h4>
|
||||
<?php HeadFooter()->render_text_area_input( 'head_any' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row form-group">
|
||||
<div class="col">
|
||||
<h4 class="label">Desktop Only:</h4>
|
||||
<?php HeadFooter()->render_text_area_input( 'head_desktop' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h4 class="label">Mobile Only:</h4>
|
||||
<?php HeadFooter()->render_text_area_input( 'head_mobile' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Footer Scripts -->
|
||||
<div class="card card-static">
|
||||
<div class="card-header">
|
||||
Footer Scripts
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row form-group">
|
||||
<div class="col">
|
||||
<h4 class="label">Any device type:</h4>
|
||||
<?php HeadFooter()->render_text_area_input( 'footer_any' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row form-group">
|
||||
<div class="col">
|
||||
<h4 class="label">Desktop Only:</h4>
|
||||
<?php HeadFooter()->render_text_area_input( 'footer_desktop' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h4 class="label">Mobile Only:</h4>
|
||||
<?php HeadFooter()->render_text_area_input( 'footer_mobile' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if( isWooCommerceActive() ) : ?>
|
||||
|
||||
<h2 class="section-title">WooCommerce Order Received Page Scripts</h2>
|
||||
|
||||
<!-- <p>Insert any script on the WooCommerce Thank You Page (order-received).</p>-->
|
||||
|
||||
<div class="card card-static">
|
||||
<div class="card-header">
|
||||
General
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<?php HeadFooter()->render_switcher_input( 'woo_order_received_disable_global' ); ?>
|
||||
<h4 class="switcher-label">Disable global head and footer scripts on Order Received page</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card card-static">
|
||||
<div class="card-header">
|
||||
Head Scripts
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row form-group">
|
||||
<div class="col">
|
||||
<h4 class="label">Any device type:</h4>
|
||||
<?php HeadFooter()->render_text_area_input( 'woo_order_received_head_any' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row form-group">
|
||||
<div class="col">
|
||||
<h4 class="label">Desktop Only:</h4>
|
||||
<?php HeadFooter()->render_text_area_input( 'woo_order_received_head_desktop' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h4 class="label">Mobile Only:</h4>
|
||||
<?php HeadFooter()->render_text_area_input( 'woo_order_received_head_mobile' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card card-static">
|
||||
<div class="card-header">
|
||||
Footer Scripts
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row form-group">
|
||||
<div class="col">
|
||||
<h4 class="label">Any device type:</h4>
|
||||
<?php HeadFooter()->render_text_area_input( 'woo_order_received_footer_any' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row form-group">
|
||||
<div class="col">
|
||||
<h4 class="label">Desktop Only:</h4>
|
||||
<?php HeadFooter()->render_text_area_input( 'woo_order_received_footer_desktop' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h4 class="label">Mobile Only:</h4>
|
||||
<?php HeadFooter()->render_text_area_input( 'woo_order_received_footer_mobile' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<h2 class="section-title">Replacements <?php renderHfBadge(); ?></h2>
|
||||
|
||||
<div class="panel">
|
||||
<div class="row">
|
||||
<div class="col text-secondary">
|
||||
<?php include 'html-variables-help.php'; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-4">
|
||||
<button class="btn btn-block btn-save">Save Settings</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
namespace PixelYourSite;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
global $post;
|
||||
|
||||
$meta = get_post_meta( $post->ID, '_pys_head_footer', true );
|
||||
|
||||
if ( ! is_array( $meta ) ) {
|
||||
|
||||
$meta = array(
|
||||
'disable_global' => false,
|
||||
'head_any' => '',
|
||||
'head_desktop' => '',
|
||||
'head_mobile' => '',
|
||||
'footer_any' => '',
|
||||
'footer_desktop' => '',
|
||||
'footer_mobile' => '',
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<style type="text/css">
|
||||
.pys-head-footer label {
|
||||
display: block;
|
||||
margin-top: 15px;
|
||||
margin-bottom: 5px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.pys-head-footer textarea {
|
||||
width: 100%;
|
||||
font-family: monospace;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="pys-head-footer">
|
||||
<p>Add any script in the Head or Footer section of your pages. You can also add custom per page scripts
|
||||
by editing each page.</p>
|
||||
</div>
|
||||
|
||||
<div class="pys-head-footer" style="margin: 15px 0;">
|
||||
<label for="pys_head_footer_disable_global" style="font-weight: normal;">
|
||||
<input name="pys_head_footer[disable_global]"
|
||||
type="checkbox"
|
||||
<?php checked( $meta['disable_global'] ); ?>
|
||||
id="pys_head_footer_disable_global"
|
||||
value="1"> Disable <a href="<?php echo admin_url( 'admin.php?page=pixelyoursite&tab=head_footer' ); ?>"
|
||||
target="_blank">global</a> head and footer scripts.
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="pys-head-footer">
|
||||
|
||||
<label for="pys_head_footer_head_any" class="control-label">Head (any device type):</label>
|
||||
<textarea name="pys_head_footer[head_any]" id="pys_head_footer_head_any"
|
||||
rows="10"><?php @esc_html_e( $meta['head_any'] ); ?></textarea>
|
||||
|
||||
<label for="pys_head_footer_head_desktop" class="control-label">Head - Desktop Only:</label>
|
||||
<textarea name="pys_head_footer[head_desktop]" id="pys_head_footer_head_desktop"
|
||||
rows="5"><?php @esc_html_e( $meta['head_desktop'] ); ?></textarea>
|
||||
|
||||
<label for="pys_head_footer_head_mobile" class="control-label">Head - Mobile Only:</label>
|
||||
<textarea name="pys_head_footer[head_mobile]" id="pys_head_footer_head_mobile"
|
||||
rows="5"><?php @esc_html_e( $meta['head_mobile'] ); ?></textarea>
|
||||
|
||||
<hr style="margin-top: 15px;">
|
||||
|
||||
<label for="pys_head_footer_footer_any" class="control-label">Footer (any device type):</label>
|
||||
<textarea name="pys_head_footer[footer_any]" id="pys_head_footer_footer_any"
|
||||
rows="10"><?php @esc_html_e( $meta['footer_any'] ); ?></textarea>
|
||||
|
||||
<label for="pys_head_footer_footer_desktop" class="control-label">Footer - Desktop Only:</label>
|
||||
<textarea name="pys_head_footer[footer_desktop]" id="pys_head_footer_footer_desktop"
|
||||
rows="5"><?php @esc_html_e( $meta['footer_desktop'] ); ?></textarea>
|
||||
|
||||
<label for="pys_head_footer_footer_mobile" class="control-label">Footer - Mobile Only:</label>
|
||||
<textarea name="pys_head_footer[footer_mobile]" id="pys_head_footer_footer_mobile"
|
||||
rows="5"><?php @esc_html_e( $meta['footer_mobile'] ); ?></textarea>
|
||||
|
||||
<hr style="margin-top: 15px;">
|
||||
|
||||
<?php include 'html-variables-help.php'; ?>
|
||||
|
||||
</div>
|
||||
|
||||
<script type="application/javascript">
|
||||
// collapse meta box by default
|
||||
jQuery('#pys-head-footer').addClass('closed');
|
||||
</script>
|
||||
@@ -0,0 +1,17 @@
|
||||
<p>You can use the following variables:</p>
|
||||
<ul>
|
||||
<li><code>[id]</code> - content ID</li>
|
||||
<li><code>[title]</code> - content title</li>
|
||||
<li><code>[categories]</code> - content categories</li>
|
||||
<li><code>[email]</code> - user's email</li>
|
||||
<li><code>[first_name]</code> - user's first name</li>
|
||||
<li><code>[last_name]</code> - user's last name</li>
|
||||
</ul>
|
||||
|
||||
<p>For the WooCommerce or Easy Digital Downloads Thank You Pages only:</p>
|
||||
<ul>
|
||||
<li><code>[order_number]</code> - order number</li>
|
||||
<li><code>[order_subtotal]</code> - order subtotal</li>
|
||||
<li><code>[order_total]</code> - order total</li>
|
||||
<li><code>[currency]</code> - currency</li>
|
||||
</ul>
|
||||
101
wp-content/plugins/pixelyoursite/modules/pinterest/pinterest.php
Normal file
101
wp-content/plugins/pixelyoursite/modules/pinterest/pinterest.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Dummy Pinterest addon used for UI demo
|
||||
*/
|
||||
|
||||
namespace PixelYourSite;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
class Pinterest extends Settings implements Pixel {
|
||||
|
||||
private static $_instance = null;
|
||||
|
||||
public static function instance() {
|
||||
|
||||
if ( is_null( self::$_instance ) ) {
|
||||
self::$_instance = new self();
|
||||
}
|
||||
|
||||
return self::$_instance;
|
||||
|
||||
}
|
||||
|
||||
public function __construct() {
|
||||
add_action( 'pys_admin_pixel_ids', array( $this, 'renderPixelIdField') );
|
||||
}
|
||||
|
||||
public function enabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function configured() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getPixelIDs() {
|
||||
return array();
|
||||
}
|
||||
|
||||
public function getPixelOptions() {
|
||||
return array();
|
||||
}
|
||||
|
||||
public function getEventData( $eventType, $args = null ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function outputNoScriptEvents() {}
|
||||
|
||||
public function render_switcher_input( $key, $collapse = false, $disabled = false ) {
|
||||
//@todo: review
|
||||
|
||||
$attr_name = "pys[pinterest][$key]";
|
||||
$attr_id = 'pys_pinterest_' . $key;
|
||||
|
||||
?>
|
||||
|
||||
<div class="custom-switch disabled">
|
||||
<input type="checkbox" name="<?php esc_attr_e( $attr_name ); ?>" value="1" disabled="disabled"
|
||||
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
|
||||
}
|
||||
|
||||
public function renderCustomEventOptions( $event ) {}
|
||||
|
||||
public function renderAddonNotice() {
|
||||
echo ' <a href="https://www.pixelyoursite.com/pinterest-tag?utm_source=pys-free-plugin&utm_medium=pinterest-badge&utm_campaign=requiere-free-add-on" target="_blank" class="badge badge-pill badge-pinterest">Requires paid add-on <i class="fa fa-external-link" aria-hidden="true"></i></a>';
|
||||
}
|
||||
|
||||
public function renderPixelIdField() {
|
||||
?>
|
||||
<div class="row align-items-center">
|
||||
<div class="col-2 py-4">
|
||||
<img class="tag-logo" src="<?php echo PYS_FREE_URL; ?>/dist/images/pinterest-square-small.png">
|
||||
</div>
|
||||
<div class="col-10">
|
||||
Add the Pinterest tag with our <a href="https://www.pixelyoursite.com/pinterest-tag?utm_source=pixelyoursite-free-plugin&utm_medium=plugin&utm_campaign=free-plugin-ids"
|
||||
target="_blank">Paid addon</a>.
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Pinterest
|
||||
*/
|
||||
function Pinterest() {
|
||||
return Pinterest::instance();
|
||||
}
|
||||
|
||||
Pinterest();
|
||||
@@ -0,0 +1,197 @@
|
||||
<?php
|
||||
|
||||
namespace PixelYourSite;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<h2 class="section-title">Super Pack Settings</h2>
|
||||
|
||||
<!-- General -->
|
||||
<div class="card card-static">
|
||||
<div class="card-header">
|
||||
General <?php renderSpBadge(); ?>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<?php renderDummySwitcher(); ?>
|
||||
<h4 class="switcher-label">Enable Super Pack</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Additional Pixel IDs -->
|
||||
<div class="card card-static">
|
||||
<div class="card-header">
|
||||
Additional Pixel IDs <?php renderSpBadge(); ?>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<p>Add additional Facebook, Google Analytics and Pinterest pixel IDs on the same site.</p>
|
||||
<?php renderDummySwitcher(); ?>
|
||||
<h4 class="switcher-label">Enable additional pixel IDs</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Dynamic Params -->
|
||||
<div class="card card-static">
|
||||
<div class="card-header">
|
||||
Dynamic Parameters for Events <?php renderSpBadge(); ?>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<p>Use page title, post ID, category or tags as your dynamic events parameters.</p>
|
||||
<?php renderDummySwitcher(); ?>
|
||||
<h4 class="switcher-label">Enable dynamic params</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Custom Thank You Page -->
|
||||
<div class="card card-static">
|
||||
<div class="card-header">
|
||||
Custom Thank You Pages <?php renderSpBadge(); ?>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<p>Define custom thank you pages (general or for a particular product) and fire the
|
||||
Meta Pixel (formerly Facebook Pixel) on it.</p>
|
||||
<?php renderDummySwitcher(); ?>
|
||||
<h4 class="switcher-label">Enable Custom Thank You Pages</h4>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ( isWooCommerceActive() ) : ?>
|
||||
<div class="row mt-3">
|
||||
<div class="col">
|
||||
<h4>WooCommerce</h4>
|
||||
<p>You can set up a global WooCommerce Thank You Page here. If you need to, you can also
|
||||
define Custom Thank You Pages for each product (edit the product and you will find this option
|
||||
in the
|
||||
right side menu).</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col col-offset-left">
|
||||
<?php renderDummySwitcher(); ?>
|
||||
<h4 class="switcher-label">Enable WooCommerce Global Thank You Page</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col col-offset-left">
|
||||
<div class="my-3">
|
||||
<label>Global Custom Page URL:</label>
|
||||
<?php renderDummyTextInput( 'Enter URL' ); ?>
|
||||
</div>
|
||||
<div>
|
||||
<label>Order Details:</label>
|
||||
<div class="custom-controls-stacked">
|
||||
<?php renderDummyRadioInput( 'Hidden', true ); ?>
|
||||
<?php renderDummyRadioInput( 'After page content' ); ?>
|
||||
<?php renderDummyRadioInput( 'Before page content' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( isEddActive() ) : ?>
|
||||
<div class="row mt-3">
|
||||
<div class="col">
|
||||
<h4>Easy Digital Downloads</h4>
|
||||
<p>You can set up a global Easy Digital Downloads Thank You Page here. If you need to,
|
||||
you can also define Custom Thank You Pages for each product (edit the product and you will find
|
||||
this
|
||||
option in the right side menu).</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col col-offset-left">
|
||||
<?php renderDummySwitcher(); ?>
|
||||
<h4 class="switcher-label">Enable Easy Digital Downloads Global Thank You Page</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col col-offset-left">
|
||||
<div class="my-3">
|
||||
<label>Global Custom Page URL:</label>
|
||||
<?php renderDummyTextInput( 'Enter URL' ); ?>
|
||||
</div>
|
||||
<div>
|
||||
<label>Order Details:</label>
|
||||
<div class="custom-controls-stacked">
|
||||
<?php renderDummyRadioInput( 'Hidden', true ); ?>
|
||||
<?php renderDummyRadioInput( 'After page content' ); ?>
|
||||
<?php renderDummyRadioInput( 'Before page content' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Remove Pixel -->
|
||||
<div class="card card-static">
|
||||
<div class="card-header">
|
||||
Remove Pixel from Pages <?php renderSpBadge(); ?>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<p>Remove Facebook, Google Analytics or Pinterest pixels from a particular page or post.</p>
|
||||
<?php renderDummySwitcher(); ?>
|
||||
<h4 class="switcher-label">Enable remove pixel from pages</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- AMP -->
|
||||
<div class="card card-static">
|
||||
<div class="card-header">
|
||||
AMP Support <?php renderSpBadge(); ?>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<p>Fire Facebook, Google Analytics or Pinterest pixels on AMP pages.</p>
|
||||
<?php renderDummySwitcher(); ?>
|
||||
<h4 class="switcher-label">Enable AMP integration</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-3">
|
||||
<div class="col-12">
|
||||
<div class="indicator indicator-off">OFF</div>
|
||||
<h4 class="indicator-label">AMP by <a href="https://wordpress.org/plugins/amp/"
|
||||
target="_blank">WordPress.com VIP, XWP, Google, and
|
||||
contributors</a></h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="indicator indicator-off">OFF</div>
|
||||
<h4 class="indicator-label">Accelerated Mobile Pages by <a
|
||||
href="https://wordpress.org/plugins/accelerated-mobile-pages/"
|
||||
target="_blank">Ahmed Kaludi, Mohammed Kaludi</a></h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-4">
|
||||
<button class="btn btn-block btn-save">Save Settings</button>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user