Tagged: x
-
AuthorPosts
-
October 11, 2016 at 2:49 pm #1211968
Nic DesignParticipantI have a client who wants to do some AB testing and signed up with Optimizely. They have a script to add the pages that will be tested but when I add it to the page via cornerstone the script does not get added properly. It looks like cornerstone automatically adds it’s own opening and closing script tag which is causing the issue as the script is basically just an opening tag with a src (<script src=”https://cdn.optimizely.com/js/7495431271.js”></script>). I found this other article (https://community.theme.co/forums/topic/optimizely-is-not-loading-the-site) but that adds the script to every page and if I add it through the customizer it also adds it to every page. Is there a way to add the script to just the pages I want?
October 11, 2016 at 5:36 pm #1212130
JadeModeratorHi there,
Kindly refer on this related thread for suggestion
https://community.theme.co/forums/topic/adding-code-into-header-on-a-specific-page/#post-117550
Hope this helps.
October 14, 2016 at 8:21 pm #1216865
Nic DesignParticipantThank you. That was helpful but can you tell me how to add to multiple pages? Do I just copy and repeat the code with a different page ID or do I use the same function with an “or” condition for the other pages?
October 15, 2016 at 1:29 am #1217064
ChristopherModeratorHi there,
if you want to add it to all pages, update your code to :
add_action('wp_head','additaional_track_script'); function additaional_track_script() { if( is_page( ) ) {?> <!--replace this line with your tracking this --> <?php } }If you want to add script to specific pages, update it to :
add_action('wp_head','additaional_track_script'); function additaional_track_script() { if( is_page(185) || is_page(10) || is_page(34)) {?> <!--replace this line with your tracking this --> <?php } }Hope it helps.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1211968 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
