Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1062038

    bperry420
    Participant

    Hello,

    I need to add the following JS code to one of my pages:

    ga(‘set’, ‘dimension1’, ’Monthly 14.95’);
    ga(‘send’, ‘event’, ‘AB’, ‘View’, ‘PricingCampaign’);

    I tried the method of opening the page in Cornerstone, then I clicked on the gear icon in the top of the left column, then I clicked on CUSTOM JS and added the code there and saved it.

    When I open the page in my browser and view the page source, the code is not there. Am I missing something?

    The page is http://petpace.com/summer/

    Stack: Renew
    WordPress 4.5.3 running X – Child Theme
    X Version: 4.5.2
    Cornerstone Version 1.2.4

    #1062345

    Darshana
    Moderator

    Hi there,

    Thanks for writing in! Please go through the following thread for examples (https://community.theme.co/forums/topic/adding-external-javascript-to-a-single-page/).

    Hope that helps.

    #1063305

    bperry420
    Participant

    Actually that does not help me. Can you please explain what the CUSTOM JS section is for in Cornerstone? Isn’t that where my custom js code should go? Pointing me to an article from 2014 does not help me. Thanks

    #1063329

    Thai
    Moderator

    Hey There,

    Please add the following code under functions.php file locates in your child theme:

    add_action( 'wp_head', 'x_wp_head' );
    function x_wp_head(){
        if(is_page( 6349 )){
      ?>
      <script type="text/javascript">
        ga('set', 'dimension1', 'Monthly 14.95');
        ga('send', 'event', 'AB', 'View', 'PricingCampaign');
      </script>
      <?php
      }
    }

    Hope it helps 🙂