• Hi,

    I need to drop in Alexa’s code to track my website for traffic. The code needs to be inserted below the <body> tag. I need to know how do this on the front page of Customizr. I do not want to create a new page for the front page – I’m using the front page with sliders, blog posts that already preset. Please advise ASAP. Thanks.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The <body> tag is loaded in customizr/header.php.

    I’ve looked up Alexa & can’t see the code needed, but I assume you could add it after the main-wrapper <div> on line 46.

    Would recommend you keep a copy of any new code as Theme files will be replaced with each new update of Customizr.

    Thread Starter jolney

    (@jolney)

    The code is given when you sign up for their site – this should be inserted on every page, however I just want it on the front page of the site. Their instructions indicate it should go after the <body> tag. I don’t know where line 46 is on the front page that you are referring. Since this author doesn’t provide the CSS to edit that is an issue.

    What you’ve got here is Javascript, not CSS. (fyi, the Customizr CSS is found in customizr/inc/css/*.css).

    You need to edit the file customizr/header.php and add your code at the end, after line 46.

    I’m not a Javascript expert, but try that first.

    Seems unusual not to include Javascript in either the <header> or <footer>, but if that’s what they’re telling you to do then what do I know ??

    Thread Starter jolney

    (@jolney)

    Thanks. I went to the CSS editor – there is no code there. In the latest update there is nothing in the editor to use. I’ve used Firefox as well to review it and that doesn’t make the code stick in the customizr editor as well. Generally, I’ve had to come here to get a code fix. This script just need to be inserted into the code for the page. It works on other sites I manage for clients but those authors provide the CSS to edit. This author does not .

    The CSS editor is there to help you amend the core CSS, which is found in customizr/inc/css/*.css files.

    But again, you have a Javascript issue, not a CSS issue.

    (Your post with Javascript has been removed, I presume by a Moderator for some reason.)

    Send me that Javascript code to [Redacted – Please keep support on these forums]. I’ll send you back a new header.php file to replace your current one.

    I can’t guarantee it will work but I’m willing to try to help you out.

    Thread Starter jolney

    (@jolney)

    Thanks, Dave. I’ll send you the code. Appreciate the assist

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Theme Author presscustomizr

    (@nikeo)

    Hi Jolney,
    Usually, this kind of code has to be inserted in the <head> section of the page. Here is a code that you can copy in you functions.php file to insert your alexa code only in the front page :

    add_action('wp_head', 'alexa_code_function');
    
    //you can use the following to insert it after <body> tag
    //add_action('before_menu','alexa_code_function');
    
    function alexa_code_function() {
    if( is_front_page() || is_home() ) { ?>
    /*YOUR ALEXA CODE HERE*/
    <?php }
    }

    Hope this helps,
    Nicolas

    Thread Starter jolney

    (@jolney)

    Andrew, I appreciate it. Generally when I’ve asked questions here, Nikeo responds pretty quickly. This is a simple code issue. Dave was kind of enough to respond. It would be great if the Editor in Customizr was included with theme so that it could edited easily. I understand the author’s point. However, with this update I just need to track my traffic on this site and I just need to insert this script. Thanks.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    @jolney – Threads turn into resources for the greater community. If those threads refer to a resource that is only available via email of a particular person then the community misses out.

    I’m not sure what the issue is here with Pastebin, PasteBin is easier and safer than email for me.

    Thread Starter jolney

    (@jolney)

    I appreciate it Nicolas. Thanks so much.

    Andrew – completely understand.

    @andrew, I understand too. No consolation, but I would have shared the solution here anyway.

    Nic’s solution is much smarter than mine so all’s well!

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Insert Alexa Code in Customizr’ is closed to new replies.