estoy usando WordPress
(v 5.3
) con WooCommerce
(v 3.8.1
). Mi píxel de Facebook registra eventos (ViewContent/InitiateCheckout/AddToCart/Purchase/etc.) en el escritorio, pero no registra eventos en dispositivos móviles (iOS). Todos mis complementos y temas están actualizados. Para mi tema, estoy usando Youplay
(v 3.7.4
).
En la búsqueda de una respuesta, he notado que algunas personas han tenido problemas con su tema obstruyendo Facebook Pixel
de trabajar en dispositivos móviles: algunas personas informaron que necesitaban comentar una línea en functions.php
– Estoy incluyendo mi tema functions.php
en caso de que alguien note algo que pueda entrar en conflicto con Facebook Pixel
trabajando en el móvil (en las publicaciones que encontré, nadie estaba usando el mismo tema que yo):
funciones.php
<?php
/**
* Youplay functions and definitions
*
* @package Youplay
*/
add_action( 'after_setup_theme', 'yp_setup' );
if ( ! function_exists( 'yp_setup' ) ) :
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which
* runs before the init hook. The init hook is too late for some features, such
* as indicating support for post thumbnails.
*/
function yp_setup() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on Youplay, use a find and replace
* to change 'youplay' to the name of your theme in all the template files
*/
load_theme_textdomain( 'youplay', get_template_directory() . '/languages' );
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );
/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded <title> tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
// Add editor style support.
add_editor_style();
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
*/
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => esc_html__( 'Primary Menu', 'youplay' ),
'primary-right' => esc_html__( 'Primary Right Menu', 'youplay' ),
) );
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support( 'html5', array(
'search-form', 'comment-form', 'comment-list', 'gallery', 'caption',
) );
/*
* Enable support for WooCommerce
*/
add_theme_support( 'woocommerce' );
// Add default image sizes
add_theme_support('post-thumbnails');
add_image_size('500x375', 500);
add_image_size('500x375_crop', 500, 375, true);
add_image_size('200x200', 200, 200, true);
add_image_size('90x90', 90, 90, true);
add_image_size('1440x900', 1440);
add_image_size('1440x900_crop', 1440, 900, true);
add_image_size('1920x1080', 1920);
// Register the three useful image sizes for use in Add Media modal
add_filter( 'image_size_names_choose', 'yp_custom_sizes' );
if ( ! function_exists( 'yp_custom_sizes' ) ) :
function yp_custom_sizes( $sizes ) {
return array_merge( $sizes, array(
'500x375_crop' => esc_html__( 'Carousel Thumbnail (500x375 crop)', 'youplay' ),
'500x375' => esc_html__( 'Carousel Thumbnail (500x375)', 'youplay' ),
'200x200' => esc_html__( 'User Avatar (200x200 crop)', 'youplay' ),
'90x90' => esc_html__( 'User Small Avatar (90x90 crop)', 'youplay' ),
'1440x900_crop' => esc_html__( '1440x900 crop', 'youplay' ),
'1440x900' => esc_html__( '1440x900', 'youplay' ),
'1920x1080' => esc_html__( '1920x1080', 'youplay' ),
) );
}
endif;
}
endif; // yp_setup
/**
* Set the content width in pixels, based on the theme's design and stylesheet.
*/
if (!isset($content_width)) {
$content_width = 1400;
}
/**
* Register widget area.
*
* @link http://codex.wordpress.org/Function_Reference/register_sidebar
*/
add_action( 'widgets_init', 'yp_widgets_init' );
if ( ! function_exists( 'yp_widgets_init' ) ) :
function yp_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Sidebar', 'youplay' ),
'id' => 'sidebar-1',
'description' => esc_html__( 'Default Sidebar', 'youplay' ),
'before_widget' => '<div id="%1$s" class="side-block widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widget-title block-title">',
'after_title' => '</h4>',
) );
register_sidebar( array(
'name' => esc_html__( 'WooCommerce Sidebar', 'youplay' ),
'id' => 'woocommerce_sidebar',
'description' => esc_html__( 'Sidebar for WooCommerce Pages', 'youplay' ),
'before_widget' => '<div id="%1$s" class="side-block widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widget-title block-title">',
'after_title' => '</h4>',
) );
register_sidebar( array(
'name' => esc_html__( 'BuddyPress Sidebar', 'youplay' ),
'id' => 'buddypress_sidebar',
'description' => esc_html__( 'Sidebar for BuddyPress Pages', 'youplay' ),
'before_widget' => '<div id="%1$s" class="side-block widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widget-title block-title">',
'after_title' => '</h4>',
) );
register_sidebar( array(
'name' => esc_html__( 'bbPress Sidebar', 'youplay' ),
'id' => 'bbpress_sidebar',
'description' => esc_html__( 'Sidebar for bbPress Pages', 'youplay' ),
'before_widget' => '<div id="%1$s" class="side-block widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widget-title block-title">',
'after_title' => '</h4>',
) );
register_sidebar( array(
'name' => esc_html__( 'Matches Sidebar', 'youplay' ),
'id' => 'matches_sidebar',
'description' => esc_html__( 'Sidebar for Matches Pages', 'youplay' ),
'before_widget' => '<div id="%1$s" class="side-block widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widget-title block-title">',
'after_title' => '</h4>',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer Widgets 1', 'youplay' ),
'id' => 'footer_widgets_1',
'description' => esc_html__( 'Footer Widgets 1 Column', 'youplay' ),
'before_widget' => '<div id="%1$s" class="side-block widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widget-title block-title">',
'after_title' => '</h4>',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer Widgets 2', 'youplay' ),
'id' => 'footer_widgets_2',
'description' => esc_html__( 'Footer Widgets 2 Column', 'youplay' ),
'before_widget' => '<div id="%1$s" class="side-block widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widget-title block-title">',
'after_title' => '</h4>',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer Widgets 3', 'youplay' ),
'id' => 'footer_widgets_3',
'description' => esc_html__( 'Footer Widgets 3 Column', 'youplay' ),
'before_widget' => '<div id="%1$s" class="side-block widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widget-title block-title">',
'after_title' => '</h4>',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer Widgets 4', 'youplay' ),
'id' => 'footer_widgets_4',
'description' => esc_html__( 'Footer Widgets 4 Column', 'youplay' ),
'before_widget' => '<div id="%1$s" class="side-block widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widget-title block-title">',
'after_title' => '</h4>',
) );
}
endif;
/**
* Enqueue scripts and styles.
*/
add_action( 'wp_enqueue_scripts', 'yp_scripts' );
if ( ! function_exists( 'yp_scripts' ) ) :
function yp_scripts() {
wp_enqueue_style( 'youplay', get_template_directory_uri() . '/style.css', '', '3.7.4' );
wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/assets/vendor/bootstrap/dist/css/bootstrap.min.css', '', '3.3.7' );
wp_enqueue_style( 'magnific-popup', get_template_directory_uri() . '/assets/vendor/magnific-popup/dist/magnific-popup.css', '', '1.1.0' );
wp_enqueue_style( 'flickity', get_template_directory_uri() . '/assets/vendor/flickity/dist/flickity.min.css', '', '2.2.0' );
// deregister bbPress styles
wp_deregister_style( 'bbp-default' );
wp_register_style( 'bbp-default', get_template_directory_uri() . '/assets/css/bbpress-styles.css' );
// theme style
$theme_style = yp_opts('theme_style');
$youplay_style_file="";
$youplay_style_version = '3.7.4';
if ($theme_style === 'custom') {
youplay_maybe_compile_scss();
if ( function_exists('nk_theme') ) {
$youplay_style_file = nk_theme()->get_compiled_css_url('youplay-custom.min.css');
$youplay_style_version = nk_theme()->get_compiled_css_version('youplay-custom.min.css');
}
if (!$youplay_style_file) {
$theme_style="dark";
}
}
if($theme_style !== 'custom') {
$youplay_style_file = get_template_directory_uri() . '/assets/css/youplay-' . $theme_style . '.min.css';
}
wp_enqueue_style('youplay-' . $theme_style, $youplay_style_file, array(), $youplay_style_version);
// rtl
if(yp_opts('general_rtl')) {
wp_enqueue_style( 'youplay-rtl', get_template_directory_uri() . '/assets/css/youplay-rtl.min.css', '', '3.7.4' );
}
wp_enqueue_script( 'bootstrap', get_template_directory_uri() . '/assets/vendor/bootstrap/dist/js/bootstrap.min.js', array('jquery'), '3.3.7', true );
wp_enqueue_script( 'font-awesome', get_template_directory_uri() . '/assets/vendor/fontawesome-free/js/all.js', array(), '5.9.0', true );
wp_enqueue_script( 'font-awesome-v4-shims', get_template_directory_uri() . '/assets/vendor/fontawesome-free/js/v4-shims.js', array('font-awesome'), '5.9.0', true );
wp_enqueue_script( 'isotope', get_template_directory_uri() . '/assets/vendor/isotope-layout/dist/isotope.pkgd.min.js', array('jquery', 'imagesloaded'), '3.0.6', true );
wp_enqueue_script( 'jquery-countdown', get_template_directory_uri() . '/assets/vendor/jquery-countdown/dist/jquery.countdown.min.js', array('jquery'), '2.2.0', true );
wp_enqueue_script( 'moment-timezone', get_template_directory_uri() . '/assets/vendor/moment-timezone/builds/moment-timezone-with-data.min.js', array('moment'), '0.5.14', true );
wp_enqueue_script( 'magnific-popup', get_template_directory_uri() . '/assets/vendor/magnific-popup/dist/jquery.magnific-popup.min.js', '', '1.1.0', true );
wp_enqueue_script( 'flickity', get_template_directory_uri() . '/assets/vendor/flickity/dist/flickity.pkgd.min.js', array('jquery', 'imagesloaded'), '2.2.0', true );
wp_enqueue_script( 'object-fit-images', get_template_directory_uri() . '/assets/vendor/object-fit-images/dist/ofi.min.js', '', '3.2.3', true );
wp_enqueue_script( 'jarallax', get_template_directory_uri() . '/assets/vendor/jarallax/dist/jarallax.min.js', '', '1.10.7', true );
wp_enqueue_script( 'skrollr', get_template_directory_uri() . '/assets/vendor/skrollr/dist/skrollr.min.js', '', '0.6.30', true );
wp_enqueue_script( 'hexagon-progress', get_template_directory_uri() . '/assets/vendor/HexagonProgress/jquery.hexagonprogress.min.js', '', '1.2.0', true );
wp_enqueue_script( 'youplay', get_template_directory_uri() . '/assets/js/youplay.min.js', array('jquery', 'bootstrap', 'isotope', 'imagesloaded', 'jquery-countdown', 'magnific-popup', 'flickity', 'object-fit-images', 'jarallax', 'hexagon-progress'), '3.7.4', true );
wp_enqueue_script( 'youplay-wp', get_template_directory_uri() . '/assets/js/youplay-wp.min.js', array('jquery', 'youplay'), '3.7.4', true );
wp_enqueue_script( 'youplay-cf7', get_template_directory_uri() . '/assets/js/youplay-cf7.min.js', array('jquery', 'youplay'), '3.7.4', true );
wp_enqueue_script( 'youplay-init', get_template_directory_uri() . '/assets/js/youplay-init.min.js', array('jquery', 'youplay'), '3.7.4', true );
$dataInit = array(
'enableParallax' => yp_opts('general_parallax'),
'enableFadeBetweenPages' => yp_opts('general_fade_between_pages') && yp_opts('general_preloader')
);
wp_localize_script('youplay-init', 'youplayInitOptions', $dataInit);
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
// Custom CSS
ob_start();
require get_template_directory() . '/inc/head_styles.php';
$custom_css = ob_get_clean();
$custom_css = wp_kses( $custom_css, array( ''', '"' ) );
$custom_css = str_replace( '>' , '>' , $custom_css );
wp_add_inline_style( 'youplay-' . $theme_style, $custom_css );
// Custom JS
wp_add_inline_script( 'youplay-init', yp_opts('general_custom_js') );
}
endif;
// Compile SCSS.
if (!function_exists('youplay_maybe_compile_scss')) :
function youplay_maybe_compile_scss() {
if ( yp_opts('theme_style') !== 'custom' || ! function_exists('nk_theme') ) {
return;
}
$theme_colors_from = yp_opts('theme_colors_from') == 'light' ? 'light' : 'dark';
$theme_main_color = yp_opts('theme_main_color');
$theme_back_color = yp_opts('theme_back_color');
$theme_back_grey_color = yp_opts('theme_back_grey_color');
$theme_text_color = yp_opts('theme_text_color');
$theme_primary_color = yp_opts('theme_primary_color');
$theme_success_color = yp_opts('theme_success_color');
$theme_info_color = yp_opts('theme_info_color');
$theme_warning_color = yp_opts('theme_warning_color');
$theme_danger_color = yp_opts('theme_danger_color');
$theme_skew_size = yp_opts('theme_skew_size');
$theme_navbar_height = yp_opts('theme_navbar_height');
$theme_navbar_small_height = yp_opts('theme_navbar_small_height');
$theme_banners_opacity = yp_opts('theme_banners_opacity') / 100;
$theme_images_opacity = yp_opts('theme_images_opacity') / 100;
$theme_images_hover_opacity = yp_opts('theme_images_hover_opacity') / 100;
$theme_data = wp_get_theme();
$theme_parent = $theme_data->parent();
if (!empty($theme_parent)) {
$theme_data = $theme_parent;
}
$theme_version = $theme_data['Version'];
$path = get_template_directory() . '/assets/css/';
$custom_vars="
@import "_helpers.scss";
@import "_variables.scss";
$theme_version:"" . $theme_version . '";
$theme:' . $theme_colors_from . ';
$main_color:' . $theme_main_color . ';
$back_color:' . $theme_back_color . ';
$back_darken_color:' . ($theme_colors_from == 'light' ? '#FFFFFF' : 'darken($back_color, 13)' ) . ';
$back_grey_color:' . $theme_back_grey_color . ';
$back_darken_grey_color: ' . ($theme_colors_from == 'light' ? 'lighten' : 'darken') . '($back_grey_color, 10);
$text_color:' . $theme_text_color . ';
$text_mute_color: rgba($text_color, 0.5);
$color_primary:' . $theme_primary_color . ';
$color_success:' . $theme_success_color . ';
$color_info:' . $theme_info_color . ';
$color_warning:' . $theme_warning_color . ';
$color_danger:' . $theme_danger_color . ';
$skew_size:' . $theme_skew_size . 'deg;
$banners_opacity:' . $theme_banners_opacity . ';
$images_opacity:' . $theme_images_opacity . ';
$images_hover_opacity:' . $theme_images_hover_opacity . ';
$navbar-height:' . $theme_navbar_height . 'px;
$navbar-sm-height:' . $theme_navbar_small_height . 'px;
@import "_includes.scss"';
nk_theme()->scss('youplay-custom.min.css', $path, $custom_vars);
}
endif;
add_action('ot_after_theme_options_save', 'youplay_maybe_compile_scss');
/**
* Admin References
*/
require get_template_directory() . '/admin/admin.php';
/**
* Custom functions that act independently of the theme templates.
*/
require get_template_directory() . '/inc/extras.php';
/**
* Colors convert functions
*/
require get_template_directory() . '/inc/colors.php';
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Comments walker
*/
require get_template_directory() . '/inc/comments-walker.php';
/**
* Custom WooCommerce functions
*/
require get_template_directory() . '/woocommerce/functions.php';
/**
* Custom BuddyPress functions
*/
require get_template_directory() . '/buddypress/functions.php';
/**
* Custom bbPress functions
*/
require get_template_directory() . '/bbpress/functions.php';
/**
* Infinitie Scroll for Posts
*/
require get_template_directory() . '/inc/lib/nk-infinite-scroll/nk-infinitie-scroll.php';
También encontré a alguien que dijo que su tema estaba eliminando un WooCommerce
gancho (creo que fue woocommerce_after_single_product
pero ya no estoy exactamente donde leo eso) – No estoy seguro de si mi tema está haciendo eso.
He comprobado que todos los Facebook Pixel
los eventos aparecen cuando no estoy en el móvil:
Puedes ver que se muestra Receiving activity
y tiene eventos listados. Cuando pruebo en el móvil me dice que no es Receiving activity
(hay un punto amarillo), y no reporta los eventos.
Encontré el código fuente donde se manejan los eventos en facebook-commerce-events-tracker.php
, ¿tal vez algo allí no es compatible con dispositivos móviles? Solo muestro lo que creo que puede ser relevante porque no tengo más espacio para el texto en esta pregunta:
facebook-comercio-eventos-tracker.php
...
class WC_Facebookcommerce_EventsTracker {
private $pixel;
private static $isEnabled = true;
const FB_PRIORITY_HIGH = 2;
const FB_PRIORITY_LOW = 11;
public function __construct( $user_info ) {
$this->pixel = new WC_Facebookcommerce_Pixel( $user_info );
add_action( 'wp_head', array( $this, 'apply_filters' ) );
// Pixel Tracking Hooks
add_action(
'wp_head',
array( $this, 'inject_base_pixel' )
);
add_action(
'wp_footer',
array( $this, 'inject_base_pixel_noscript' )
);
add_action(
'woocommerce_after_single_product',
array( $this, 'inject_view_content_event' ),
self::FB_PRIORITY_HIGH
);
add_action(
'woocommerce_after_shop_loop',
array( $this, 'inject_view_category_event' )
);
add_action(
'pre_get_posts',
array( $this, 'inject_search_event' )
);
add_action(
'woocommerce_after_cart',
array( $this, 'inject_add_to_cart_redirect_event' )
);
add_action(
'woocommerce_add_to_cart',
array( $this, 'inject_add_to_cart_event' ),
self::FB_PRIORITY_HIGH
);
add_action(
'wc_ajax_fb_inject_add_to_cart_event',
array( $this, 'inject_ajax_add_to_cart_event' ),
self::FB_PRIORITY_HIGH
);
add_action(
'woocommerce_after_checkout_form',
array( $this, 'inject_initiate_checkout_event' )
);
add_action(
'woocommerce_thankyou',
array( $this, 'inject_gateway_purchase_event' ),
self::FB_PRIORITY_HIGH
);
add_action(
'woocommerce_payment_complete',
array( $this, 'inject_purchase_event' ),
self::FB_PRIORITY_HIGH
);
add_action(
'wpcf7_contact_form',
array( $this, 'inject_lead_event_hook' ),
self::FB_PRIORITY_LOW
);
}
...
/**
* Triggers ViewContent product pages
*/
public function inject_view_content_event() {
if ( ! self::$isEnabled ) {
return;
}
global $post;
$product = wc_get_product( $post->ID );
$content_type="product_group";
if ( ! $product ) {
return;
}
// if product is a variant, fire the pixel with content_type: product_group
if ( WC_Facebookcommerce_Utils::is_variation_type( $product->get_type() ) ) {
$content_type="product";
}
$content_ids = WC_Facebookcommerce_Utils::get_fb_content_ids( $product );
$this->pixel->inject_event(
'ViewContent',
array(
'content_name' => $product->get_title(),
'content_ids' => json_encode( $content_ids ),
'content_type' => $content_type,
'value' => $product->get_price(),
'currency' => get_woocommerce_currency(),
)
);
}
Aquí está el inject_event
función mencionada anteriormente:
/**
* Preferred method to inject events in a page, normally you should use this
* instead of WC_Facebookcommerce_Pixel::build_event()
*/
public function inject_event( $event_name, $params, $method = 'track' ) {
$code = self::build_event( $event_name, $params, $method );
$this->last_event = $event_name;
if ( WC_Facebookcommerce_Utils::isWoocommerceIntegration() ) {
WC_Facebookcommerce_Utils::wc_enqueue_js( $code );
} else {
printf(
'
<!-- Facebook Pixel Event Code -->
<script>
%s
</script>
<!-- End Facebook Pixel Event Code -->
',
$code
);
}
}
Me di cuenta en el móvil: la sección que debería tener el Facebook Pixel
el código se ve extraño:
<!-- Facebook Pixel Code -->
<noscript>
<img height="1" width="1" style="display:none" alt="fbpx"
src="https://www.facebook.com/tr?id=549560325605747&ev=PageView&noscript=1"/>
</noscript>
<!-- End Facebook Pixel Code -->
Arriba: ¿Por qué hay un img
elemento donde debe ir el código de Facebook Pixel?
EDITAR: Para la pregunta anterior, parece que es lo mismo para el escritorio, por lo que no creo que esto importe, aunque no entiendo qué es.
Encontré dónde está el código de evento real en mi sitio web cuando se inyecta; parece que se está registrando como un PageView
aunque, y debería ser ViewContent
– ¿Tal vez la categorización incorrecta está causando el problema (un conflicto)?
<!-- WooCommerce Facebook Integration Begin -->
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','https://connect.facebook.net/en_US/fbevents.js');
<script>
fbq('init', 'xxxxx', {}, {
"agent": "woocommerce-3.8.1-1.9.15"
});
fbq('track', 'PageView', {
"source": "woocommerce",
"version": "3.8.1",
"pluginVersion": "1.9.15"
});
document.addEventListener('DOMContentLoaded', function() {
jQuery && jQuery(function($){
$('body').on('added_to_cart', function(event) {
// Ajax action.
$.get('?wc-ajax=fb_inject_add_to_cart_event', function(data) {
$('head').append(data);
});
});
});
}, false);
</script>
<!-- DO NOT MODIFY -->
<!-- WooCommerce Facebook Integration end -->
Así es como se ve la misma sección en el escritorio: noté que tiene un em
atributo que es mi correo electrónico que no está allí en la versión móvil; ¿quizás esto es importante y debe incluirse cuando el sitio se representa en el móvil?
fbq('init', 'xxxx', {
"em": "myemail7@gmail.com"
}, {
"agent": "woocommerce-3.8.1-1.9.15"
});
fbq('track', 'PageView', {
"source": "woocommerce",
"version": "3.8.1",
"pluginVersion": "1.9.15"
});
document.addEventListener('DOMContentLoaded', function() {
jQuery && jQuery(function($){
$('body').on('added_to_cart', function(event) {
// Ajax action.
$.get('?wc-ajax=fb_inject_add_to_cart_event', function(data) {
$('head').append(data);
});
});
});
}, false);
**EDITAR:**Para arriba, aprendí que el correo electrónico está allí porque soy un usuario del sitio en mi computadora, pero no en mi teléfono, así que creo que está bien que mi correo electrónico no esté allí para dispositivos móviles. . Este es el código que crea el código anterior en Facebook/WooCommerce
código fuente:
private function pixel_init_code() {
$version_info = self::get_version_info();
$agent_string = sprintf(
'%s-%s-%s',
$version_info['source'],
$version_info['version'],
$version_info['pluginVersion']
);
$params = array(
'agent' => $agent_string,
);
return apply_filters(
'facebook_woocommerce_pixel_init',
sprintf(
"fbq('init', '%s', %s, %s);n",
esc_js( self::get_pixel_id() ),
json_encode( $this->user_info, JSON_PRETTY_PRINT | JSON_FORCE_OBJECT ),
json_encode( $params, JSON_PRETTY_PRINT | JSON_FORCE_OBJECT )
)
);
}
EDITAR: Encontré dónde está el ViewContent
Facebook Pixel
El código de seguimiento es: se encuentra en la parte inferior de la página tanto para dispositivos móviles como para computadoras de escritorio y tiene el mismo aspecto para ambos:
jQuery(function($) {
/* WooCommerce Facebook Integration Event Tracking */
fbq('track', 'ViewContent', {
"source": "woocommerce",
"version": "3.8.1",
"pluginVersion": "1.9.15",
"content_name": "Accessory Power ENHANCE ENGXH10100BKEW GX-H1 Gaming Headset - Black, Blue",
"content_ids": "["TFL-ENGXH10100BKEW-OPEN-BOX"]",
"content_type": "product_group",
"value": "39.85",
"currency": "USD"
});
});
Ninguno de los eventos se activa en dispositivos móviles; ambos se activan en computadoras de escritorio.
¿Por qué es mi Facebook Pixel
no funciona en el móvil (iOS)? En mi teléfono, he probado ambos con Safari
y Chrome
.
EDITAR
De acuerdo con los comentarios que he visto a lo largo del código fuente, creo que debería estar colocando el Facebook Pixel
código de evento en el <footer>
pero parece estar colocándolo en el <head>
en cambio, ¿importaría esto para dispositivos móviles?
.