Home › Forums › Support › Apply GA in Elements to Woocommerce Checkout? This topic has 10 replies, 3 voices, and was last updated 4 years, 7 months ago by Tom. Viewing 11 posts - 1 through 11 (of 11 total) Author Posts September 11, 2019 at 3:17 am #1006570 Edin I’ve added the GA code to Elements in GP. In the “Display Rules” I only want to display the code on the checkout page AND the “Order Received” page (which is /checkout/order-received/******). The checkout page I’ve figured out, but how do I activate the GA code only on the “Order Received” page. Thanks, Edin September 11, 2019 at 5:53 am #1006647 DavidStaff Customer Support Hi there, if it is the same code being used on the Checkout then all endpoints e.g /order-received will also display any hooks you applied to the Checkout. If you need a specific code for the order-received page then it would probably require a redirect to your own ‘thank you’ page. September 13, 2019 at 12:41 am #1008399 Edin Thank you, David. So this is enough? September 13, 2019 at 5:04 am #1008539 DavidStaff Customer Support Thats correct. September 18, 2019 at 11:29 pm #1013221 Edin Hi David, I tested this and it does not work on the Woocommerce “Order Received” page. It does work on the checkout page itself: /checkouts/mycheckoutpage How can I make it work on the “Order Received” page: /checkout/order-received/ Thanks, Edin September 19, 2019 at 10:27 am #1013824 TomLead Developer Lead Developer Hi there, Is “Order Received” a physical page in the Pages area? If so, can you choose it in the Display Rules? September 19, 2019 at 10:33 am #1013832 Edin Unfortunately not. I seems generated by Woocommerce. September 19, 2019 at 6:35 pm #1014075 TomLead Developer Lead Developer Looks like we need to use a filter. For example: add_filter( 'generate_hook_element_display', function( $display, $element_id ) { if ( ! function_exists( 'is_wc_endpoint_url' ) ) { return $display; } if ( 123 == $element_id && is_wc_endpoint_url( 'order-received' ) ) { return true; } return $display; }, 10, 2 ); You just need to update 123 with the ID of the Hook Element you created. September 19, 2019 at 11:26 pm #1014159 Edin Thank you, Tom, but it doesn’t seem to work. Copied the code into functions.php, changed 123 to 2211. But there’s no GA code in /checkout/order-received/ Thanks, Edin September 20, 2019 at 12:32 am #1014179 Edin Actually, it’s okay Tom. I’ve changed it to “entire site”. It does make sense to have analytics on every page, even if it slows down the site (maybe there’s a way to minimize that). Thank you! September 20, 2019 at 9:47 am #1014662 TomLead Developer Lead Developer Ah, there was an error in my code – I just fixed it if you want to try it again. Author Posts Viewing 11 posts - 1 through 11 (of 11 total) You must be logged in to reply to this topic. Log In Username: Password: Keep me signed in Log In