Tell us what you are trying to do?
I had support but I didn't respond for too long. I need to add code to make the english pages load in the english pixel and the same with dutch pages and pixel.
Languages: English (English )Spanish (Español )Italian (Italiano )
Timezone: Europe/Rome (GMT+02:00)
Hello!
Well, this would be out of the scope of this support since it falls under the category of custom coding, however, i want to point you in the right direction (i just can't debug the code).
A function like this one added to your active theme's function.php file will probably do the trick:
function pixelByLanguages(){
$current_language= apply_filters( 'wpml_current_language', NULL);
/* Note that XX refers to the language code. i.e: en - English, es-Spanish, it-italian, etc. */
if($current_language == 'XX'){
echo "PIXEL JS CODE GOES HERE INSIDE <script></script> TAG";
} else{
/*this one will be used as DEFAULT in case no language defined above is found. you can remove this part if you don't want to show the pixel in one of the languages or if you want to instead show it in all the other languages except the one defined above */
echo "PIXEL JS CODE GOES HERE INSIDE <script></script> TAG";
}
}
add_action('wp_head','pixelByLanguages');
/* you can change wp_head to wp_footer if you want to add the code in the footer*/
I tried to put in the code with no success unfortunately. I understand this is not in the scope of the support but every tip is more then welcome. In the screenshot you can see how I put in the code and what happens when its loaded in. When checking the pixel with Facebook pixel helper it doesn't show up the english one.
Languages: English (English )Spanish (Español )Italian (Italiano )
Timezone: Europe/Rome (GMT+02:00)
Hi there,
Indeed what you did wouldn't work because of a very simple yet tricky to see issue:
you are echoing the code using double quotes, right? however the pixel is also using double quotes for a few things so you have 2 ways to fix this:
1) Make sure all double quotes (") in the facebook pixel are replaced by single quotes ('). This won't mess up with the pixel script, so don't worry about that.
2) Add a backslash right before the double quotes inside the facebook pixel script (it would look like this --> \")
That should fix the problem.
Regards.
Manage Cookie Consent
We use cookies to optimize our website and services. Your consent allows us to process data such as browsing behavior. Not consenting may affect some features.
Functional
Always active
Required for our website to operate and communicate correctly.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
We use these to analyze the statistics of our site. Collected information is completely anonymous.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
These cookies track your browsing to provide ads relevant to you.