• Resolved SarahDn

    (@sarahdn)


    Hi, thank you so much for the Customizr theme & all the great support info which I find so useful.

    I’ve read your article many times about setting up Google Analytics tracking code (here)

    Under the section on adding it manually, I think there may be something wrong with the PHP code, I think before <!--START OF TRACKING CODE -->), and possibly after <!-- END OF TRACKING CODE -->

    I’ve put the code you recommend in my Child PHP file (with my unique GA code pasted in the relevant section).

    I’ve been getting the following error, referring to the line that says <script>:

    Parse error: syntax error, unexpected ‘)’ in […][…] on line 2

    I’ve tried a lot of googling & researching, but am not expert enough to solve it.

    My whole Child Theme PHP is currently not working properly & I’m wondering if this may be the problem?

    Please could you let me know if you see an error in this code, and / or any ideas to fix it?

    I’m extremely grateful for any help you can give me

    Thank you so much
    Sarah

Viewing 9 replies - 1 through 9 (of 9 total)
  • Hi,
    Can you post your code on pastebin or similar site? It will be easy to diagnose.

    Thread Starter SarahDn

    (@sarahdn)

    Hi Menaka, thank you, good idea as usual! I’ve pasted the code at pastebin here

    I’ve pasted my whole Child Functions.php for completeness – The Google Analytics codes starts at line 94

    I hope you can spot something simple. I keep crashing my site trying to fix it & currently none of this PHP is feeding through & working.

    Thank you so much for taking a look, I really appreciate your time & expertise,
    Sarah

    • This reply was modified 9 years, 4 months ago by SarahDn. Reason: Had to take out identifying info from code
    Thread Starter SarahDn

    (@sarahdn)

    Hi Zephyr Designs, thank you so much, that is definitely a sensible option I agree!
    Ideally I’d like to not add another plugin to my site if I can, but I agree this is definitely a good backup option if I can’t resolve it.
    Sarah

    Hi,
    Doesn’t seem to have any problem. Have you checked
    1. Changing to another theme?
    2. Changing to the parent Customizr theme?
    3. Removing only Google analytics code in functions.php?

    In the above three cases, what happens?

    Thread Starter SarahDn

    (@sarahdn)

    Thanks Menaka – I was wondering if lines 96 & 109 were ok?
    Didn’t know if they were an unnecessary repeat? Glad you think the code generally looks ok

    I’ll do those tests you suggest & report back (may have to be on Monday)

    Many thanks for looking into this
    Sarah

    Hi,
    Try removing the comments
    /* START OF TRACKING CODE */
    and
    /* END OF TRACKING CODE */

    Thread Starter SarahDn

    (@sarahdn)

    Thank you Menaka, yes occasionally those comments have appeared on my site in the header, so good idea to remove them.

    I started going through your ideas & also tested plugins again. I was sure I had tested my caching plugin WPSuperCache, but when I turned it off again, the PHP started working again.

    So thank you, the GA code seems to be working again now.
    I’m very grateful for your help
    Sarah

    Glad 🙂
    Will you mark this post as resolved?

    • This reply was modified 9 years, 4 months ago by Menaka S..
    Thread Starter SarahDn

    (@sarahdn)

    Thanks Menaka, of course, just wanted to check if you had anything else to add, thank you again.

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Customizr & Google Analytics Tracking Code’ is closed to new replies.