peorthyr
Forum Replies Created
-
Thanks, this seems to be a nice workaround, I post the entire code, I added a couple of console.log to debug it.
Also, to view the order page, I’ve used this plugin: thank you page viewer
function add_datalayer_script()
{
if (is_order_received_page()) {
global $wp;
// Get the order ID from the URL
$order_id = apply_filters('woocommerce_thankyou_order_id', absint($wp->query_vars['order-received']));
if (!$order_id) {
return;
}
// Get the order object
$order = wc_get_order($order_id);
if (!$order) {
return;
}
// Prepare order data
$order_data = [
'order_id' => $order->get_id(),
'order_total' => $order->get_total(),
'currency' => $order->get_currency(),
'products' => []
];
// Loop through order items
foreach ($order->get_items() as $item) {
$product = $item->get_product();
if (!$product) {
continue;
}
$order_data['products'][] = [
'id' => $product->get_id(),
'name' => $product->get_name(),
'price' => $product->get_price(),
'quantity' => $item->get_quantity()
];
}
// Output the data layer script
?>
<script>
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'event': 'purchase',
'order': <?php echo json_encode($order_data); ?>
});
// console.log("dataLayer pushed");
// console.log(window.dataLayer);
</script>
<?php
}else{
?>
<script>
//console.log("not a purchase page");
</script>
<?php
}
}
add_action('wp_footer', 'add_datalayer_script');I’ve got the same exact problem.
Any other event seems ok, but the purchase event is not fired anymore. there isn’t any js error on the page, and the server isn’t loggin any problem.Good morning, I’ve the same problem, rised about a month ago (beginning of May).
all events, ecommerce or not, seems to works fine, but purchases are dropped to 0 on analytics, I’ve done some tests and seems that on the order-recieved page nothing happens on the ecommerce side, the page_view is sent corectly, as the scroll event, or any other “normal” events.I’ve checked the server logs, but nothing happens, no errors, both in frontend and backend.
the js console is clear, and everything looks good, but no purchase event is tracked, regardless the browser in my case.
Forum: Plugins
In reply to: [Pixel Caffeine] Pixel Caffeine Plug-in deprecation@adespresso where is the official page you mentioned?
thanks.Hi Thomas, thanks for the quick response!
I supposed that the problem was something like you say, I have a question, is there a way to make the plugin handle lists of products outside the standard procut lists? I mean what does it need? something pushed into the datalayer in those pages? or a particular structure of the product element? Since I can modify quite anything on my sites, what do you need to be there in order to make the plugin works?thanks in advance!
just checkin that in other “list” pages, this problem seems not to be present.
I’ve already checked this, the attribute is the right one. Seems to be something related to “how the product feed pro” is retrieving the data, oh well, or “how ACF is saving the data”, depends on how you see it.
perhaps ACF is saving only the id of the field and retrieve the field value with that id on a different table. I haven’t taken a look a he db yet, but I’ll give it a glance later.Hi, thanks for the quick response,
everything you describe is exactly what I’ve done on my site. Seems that something else make something somewhere…
I’m digging into this problem a little further, actually I’ve solved the issue not using the ACF field but te standard short description one and seems to works.mail sent.
Hi, I’m writing the email right now, thanks a lot!
digging a little more seems that the problem is related to the parsing of the html, infact in the html 4.0 spec the “noscript” can be placed only into the body, while in the html 5 spec the noscript tag can be placed everywhere.
the weird thing is that everything on the page (html spec, doctype, charset) is “saying” that the document is html 5…
I really cannot explain this behavior, but is affecting a lot of website with this plugin.
checked, both placed but no “custom code” is added on the page
I have deactivated the plugin that makes the “alt” attribute on divs, but nothing happens.
by the way, now is not active anymore.after some research it appear that the <noscript> tag makes wordpress (or the browser) close the <head> tag and open the <body> tag.
this is very weird.I’ve done several try, and for example, changing the <noscript> tag into <nonscript> do not have the same behaviour, removing the <noscript> makes everything looks fine…
Forum: Plugins
In reply to: [qTranslate X] error when number of menu item over 35Same problem here.
I would like to prevent qtranslate to work on menu items, is it possible?
I have a english menu by default, and this can easy work with all the other languages on the site so for me could be a solution to just prevent qtransalte to be flooded by all the menu voices,how can I prevent the execution of qtranslate on menu items? it could be nice to have a selector like the one in where you chose which post type have to be trasnalted.
wow…simple and effective, maybe I had to make sure the function is fired only once, but I’ll test it soon, so I should handle this issue if it presents.
well, this is very usefull, thanks a lot Caleb.