I know how to add the code to the header.twig template.
But the problem is that I want to use one version of the Pixel code for my checkout success page and another version for all my other pages.
I think I need some kind of conditional that will check the page. In doing some research, my understanding is that I should be able to check a page's route to see if it is the checkout success page?
But, I was having a hard time working with the twig files.
I did one test like this below, to see if I could test for the about us page, but it did not work. Broke whole site.
Code: Select all
{% if $_GET['route'] is defined and $_GET['route'] == 'information/information&information_id=4' %}
<!-- Facebook Pixel Code -->
<!-- End Facebook Pixel Code -->
{% endif %}
Is is possible to check for the page's route, and use that in a conditional?
Is there some better way to add specific facebook pixel code to specific pages?