Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1209316
    makersbootcamp
    Participant

    Hi there,

    I’m trying to include this script in the header:

    <script src="//lp.makersboot.camp/packages/innova_analytics_log/js/analytics.js"
    id="cloud_cmo" data-cmo-url="http://lp.makersboot.camp"
    data-includeparam="yes"></script>

    I tried with two methods I found on the board. Currently:

    //Innova Tracking Script for all Pages
    // =============================================================================
    add_action( 'wp_head', 'adding_scripts_to_head', 10 );
    
    function adding_scripts_to_head(){
       echo "<script src="//lp.makersboot.camp/packages/innova_analytics_log/js/analytics.js"
    id="cloud_cmo" data-cmo-url="http://lp.makersboot.camp"
    data-includeparam="yes"></script>";
    }
    

    However, it completely erases my page. Is this something with my implementation of with the tracking script?

    #1209413
    Lely
    Moderator

    Hi There,

    Please try this code instead:

    //Innova Tracking Script for all Pages
    // =============================================================================
    add_action( 'wp_head', 'adding_scripts_to_head', 10 );
    
    function adding_scripts_to_head(){
       ?>
       <script src="//lp.makersboot.camp/packages/innova_analytics_log/js/analytics.js"
    id="cloud_cmo" data-cmo-url="http://lp.makersboot.camp"
    data-includeparam="yes"></script>
    <?php
    }

    On your code you have displayed using double quotes. But then the script is using double quotes too. This creates JS error.

    Hope this helps.

    #1209416
    makersbootcamp
    Participant

    Thanks for the help. Sadly my page still goes blank when I add the code to functions.php

    I’ll attach all of the code just to be sure.

    //Innova Tracking Codes for EACH SINGLE PAGE
    // =============================================================================
    // English
    // Front Page
    function third_party_tracking_code() {
      if(is_page(5)){
    ?>
      
     <img src="http://lp.makersboot.camp/beacon.gif?campaign_id=64406bbd-cad0-472b-9119-cd225ea0b438">
      
    <?php
       }
    }
    
    add_action( 'x_before_site_begin', 'third_party_tracking_code' );
    
    // Explanation Page (FAQ)
    function third_party_tracking_code() {
      if(is_page(7293)){
    ?>
      
     <img src="http://lp.makersboot.camp/beacon.gif?campaign_id=6c95efe2-57e4-48b2-99c9-ff6602376a46">
      
    <?php
       }
    }
    
    add_action( 'x_before_site_begin', 'third_party_tracking_code' );
    
    // Contact
    function third_party_tracking_code() {
      if(is_page(30)){
    ?>
      
     <img src="http://lp.makersboot.camp/beacon.gif?campaign_id=289d4b34-06df-4c0b-9606-011398b2d57f">
      
    <?php
       }
    }
    
    add_action( 'x_before_site_begin', 'third_party_tracking_code' );
    
    // Apply
    function third_party_tracking_code() {
      if(is_page(7360)){
    ?>
      
     <img src="http://lp.makersboot.camp/beacon.gif?campaign_id=aeaae250-0383-4cfa-920e-620f29aa5987">
    
      
    <?php
       }
    }
    
    add_action( 'x_before_site_begin', 'third_party_tracking_code' );
    
    // Japanese
    // Front Page
    function third_party_tracking_code() {
      if(is_page(8797)){
    ?>
      
     <img src="http://lp.makersboot.camp/beacon.gif?campaign_id=799675da-c9c6-42cc-ab50-51ba464f7409">
      
    <?php
       }
    }
    
    add_action( 'x_before_site_begin', 'third_party_tracking_code' );
    
    // Explanation Page (FAQ)
    function third_party_tracking_code() {
      if(is_page(9187)){
    ?>
      
     <img src="http://lp.makersboot.camp/beacon.gif?campaign_id=e1d07f25-a379-4f23-a1be-136f801fe984">
      
    <?php
       }
    }
    
    add_action( 'x_before_site_begin', 'third_party_tracking_code' );
    
    // Contact
    function third_party_tracking_code() {
      if(is_page(9191)){
    ?>
      
     <img src="http://lp.makersboot.camp/beacon.gif?campaign_id=a1ee34ce-8dd9-469f-bd30-097b2672a57c">
      
    <?php
       }
    }
    
    add_action( 'x_before_site_begin', 'third_party_tracking_code' );
    
    // Apply
    function third_party_tracking_code() {
      if(is_page(9246)){
    ?>
      
     <img src="http://lp.makersboot.camp/beacon.gif?campaign_id=d2458fcb-2ca8-4ece-b740-4aebd5b2b1bd">
    
      
    <?php
       }
    }
    
    add_action( 'x_before_site_begin', 'third_party_tracking_code' );
    #1209457
    Christopher
    Moderator

    Hi there,

    You have added different functions but they all have same name (third_party_tracking_code). Functions should have unique names.

    e.g :

    function third_party_tracking_code() {
      if(is_page(5)){
    ?>
      
     <img src="http://lp.makersboot.camp/beacon.gif?campaign_id=64406bbd-cad0-472b-9119-cd225ea0b438">
      
    <?php
       }
    }
    
    add_action( 'x_before_site_begin', 'third_party_tracking_code' );
    
    // Explanation Page (FAQ)
    function third_party_tracking_code_explanation() {
      if(is_page(7293)){
    ?>
      
     <img src="http://lp.makersboot.camp/beacon.gif?campaign_id=6c95efe2-57e4-48b2-99c9-ff6602376a46">
      
    <?php
       }
    }
    
    add_action( 'x_before_site_begin', 'third_party_tracking_code_explanation' );

    Hope it helps.

    #1210642
    makersbootcamp
    Participant

    That makes sense, thank you.

    I’ve amended the code to this:

    //Innova Tracking Script for all Pages
    // =============================================================================
    add_action( 'wp_head', 'adding_scripts_to_head', 10 );
    
    function adding_scripts_to_head(){
       ?>
       <script src="//lp.makersboot.camp/packages/innova_analytics_log/js/analytics.js"
    id="cloud_cmo" data-cmo-url="http://lp.makersboot.camp"
    data-includeparam="yes"></script>
    <?php
    }
    
    //Innova Tracking Codes for EACH SINGLE PAGE
    // =============================================================================
    // English
    // Front Page
    function third_party_tracking_code1() {
      if(is_page(5)){
    ?>
      
     <img src="http://lp.makersboot.camp/beacon.gif?campaign_id=64406bbd-cad0-472b-9119-cd225ea0b438">
      
    <?php
       }
    }
    
    add_action( 'x_before_site_begin', 'third_party_tracking_code1' );
    
    // Explanation Page (FAQ)
    function third_party_tracking_code2() {
      if(is_page(7293)){
    ?>
      
     <img src="http://lp.makersboot.camp/beacon.gif?campaign_id=6c95efe2-57e4-48b2-99c9-ff6602376a46">
      
    <?php
       }
    }
    
    add_action( 'x_before_site_begin', 'third_party_tracking_code2' );
    
    // Contact
    function third_party_tracking_code3() {
      if(is_page(30)){
    ?>
      
     <img src="http://lp.makersboot.camp/beacon.gif?campaign_id=289d4b34-06df-4c0b-9606-011398b2d57f">
      
    <?php
       }
    }
    
    add_action( 'x_before_site_begin', 'third_party_tracking_code3' );
    
    // Apply
    function third_party_tracking_code4() {
      if(is_page(7360)){
    ?>
      
     <img src="http://lp.makersboot.camp/beacon.gif?campaign_id=aeaae250-0383-4cfa-920e-620f29aa5987">
    
      
    <?php
       }
    }
    
    add_action( 'x_before_site_begin', 'third_party_tracking_code4' );
    
    // Japanese
    // Front Page
    function third_party_tracking_code5() {
      if(is_page(8797)){
    ?>
      
     <img src="http://lp.makersboot.camp/beacon.gif?campaign_id=799675da-c9c6-42cc-ab50-51ba464f7409">
      
    <?php
       }
    }
    
    add_action( 'x_before_site_begin', 'third_party_tracking_code5' );
    
    // Explanation Page (FAQ)
    function third_party_tracking_code6() {
      if(is_page(9187)){
    ?>
      
     <img src="http://lp.makersboot.camp/beacon.gif?campaign_id=e1d07f25-a379-4f23-a1be-136f801fe984">
      
    <?php
       }
    }
    
    add_action( 'x_before_site_begin', 'third_party_tracking_code6' );
    
    // Contact
    function third_party_tracking_code7() {
      if(is_page(9191)){
    ?>
      
     <img src="http://lp.makersboot.camp/beacon.gif?campaign_id=a1ee34ce-8dd9-469f-bd30-097b2672a57c">
      
    <?php
       }
    }
    
    add_action( 'x_before_site_begin', 'third_party_tracking_code7' );
    
    // Apply
    function third_party_tracking_code8() {
      if(is_page(9246)){
    ?>
      
     <img src="http://lp.makersboot.camp/beacon.gif?campaign_id=d2458fcb-2ca8-4ece-b740-4aebd5b2b1bd">
    
      
    <?php
       }
    }
    
    add_action( 'x_before_site_begin', 'third_party_tracking_code8' );

    However I still kill my site. Are there any other syntax errors?

    #1211028
    Christopher
    Moderator

    Hi there,

    I tried your code on my installation and it worked fine. Please enable debugging mode by adding define('WP_DEBUG', true); to wp-config.php file.

    This time you should see some errors, share errors with us.

    Please provide us with URL, login and FTP credentials.

    Thanks.

    #1212710
    makersbootcamp
    Participant
    This reply has been marked as private.
    #1213078
    Thai
    Moderator

    Hey There,

    Can you send us with some screenshots?

    Many thanks.

  • <script> jQuery(function($){ $("#no-reply-1209316 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>