- This topic has 10 replies, 3 voices, and was last updated 3 years, 4 months ago by
Tom.
-
AuthorPosts
-
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,
EdinSeptember 11, 2019 at 5:53 am #1006647David
StaffCustomer SupportHi 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.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/September 13, 2019 at 12:41 am #1008399Edin
Thank you, David.
So this is enough?
September 13, 2019 at 5:04 am #1008539David
StaffCustomer SupportThats correct.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/September 18, 2019 at 11:29 pm #1013221Edin
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,
EdinSeptember 19, 2019 at 10:27 am #1013824Tom
Lead DeveloperLead DeveloperHi there,
Is “Order Received” a physical page in the Pages area? If so, can you choose it in the Display Rules?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentSeptember 19, 2019 at 10:33 am #1013832Edin
Unfortunately not. I seems generated by Woocommerce.
September 19, 2019 at 6:35 pm #1014075Tom
Lead DeveloperLead DeveloperLooks 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.Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentSeptember 19, 2019 at 11:26 pm #1014159Edin
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,
EdinSeptember 20, 2019 at 12:32 am #1014179Edin
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 #1014662Tom
Lead DeveloperLead DeveloperAh, there was an error in my code – I just fixed it if you want to try it again.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-development -
AuthorPosts
- You must be logged in to reply to this topic.