[Resolved] Changes on Staging not Syncing

Home Forums Support [Resolved] Changes on Staging not Syncing

Home Forums Support Changes on Staging not Syncing

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1191274
    Joe

    Hi there, I’m having a very weird issue:

    – I added the crazyegg tracking script to my staging website by going to GeneratePress > Elements and adding it as a hook for the header for all pages, exactly the same way I added the Google Analytics tracking code.

    – When I published it I see it on my chrome browser without any issue by going to Inspect > then searching for the tracking script. It’s on line 157.

    – When I tried to sync my staging to production I could not see the new script on production

    – So I wrote to Cloudways, my hosting provider, asking them why staging wasn’t syncing to production
    – Turns out they could not see the new code on staging NOR production, it was completely non-existent for them

    – While I can indeed see the new piece of code on Chrome, when I checked on Firefox it’s not there either, so for some reason, which is just bizarre

    – I cleared all of my caches: regular, Cloudflare, WP Rocket, etc… and it did not seem to help the problem

    – Cloudways told me to contact my theme provider to see if you can help me figure this out… any idea what the problem could be?

    Staging site: https://wordpress-373625-1192257.cloudwaysapps.com
    Live site: https://ir.statecraftsims.com/

    #1191378
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Elements are just a form of custom post type. If you go into “Appearance > Elements” in your staging or live site, do you see the Element you created?

    If so, are the Display Rules the same? Perhaps something about the sync processed messed with them?

    Let me know 🙂

    #1192370
    Joe

    Ok, I still am having this problem but I actually think maybe it’s not a staging sync deal, it’s that my code isn’t fully appearing.

    So I can see the “hook” in both the wordpress admins and it looks EXACTLY the same. I’ve published it, cleared the cache, etc. In Chrome if I do “inspect” for either ULR I can search for crazyegg and see the script on line 157. In Firefox the script doesn’t show up for either one. If I check the code installation via Crazyegg it says the code isn’t installed on the site.

    I did this hook exactly the same way as the google analytics hook so it’s very odd to me that I’m having this random problem.

    I did a hook, and added the code:
    <script type=”text/javascript” src=”//script.crazyegg.com/pages/scripts/0085/8323.js” async=”async”></script>

    set it to wp_head and location “Entire Site”
    In the admin it says it’s published with visibility public

    #1193055
    Tom
    Lead Developer
    Lead Developer

    Some servers won’t allow for <script> elements to be saved to a database for security reasons. For testing purposes, what if you change the content to “Hi!”? Does the text show up in your source?

    #1193222
    Joe

    Hi! Yes, if I change my text to just say “hi” it does indeed show up on all browsers in the code.

    How do I deal with this? I’d really love to be able to use crazyegg right now and get that script added. What do you suggest?

    Thanks so much for the help here!!

    #1193382
    Tom
    Lead Developer
    Lead Developer

    So that means your server is likely blocking the <script> element from being added to the database. It’s usually a mod_security setting.

    They should be able to fix the issue for you quite easily.

    Otherwise, you’ll need to use a function:

    add_action( 'wp_head', function() {
        ?>
            Your script in here.
        <?php
    } );
    #1198726
    Joe

    Hi Tom, I finally figured this out thank GOODNESS! It was an issue with WP Rocket and the Crazyegg script. I had to add the script in WP Rocket settings -> File Optimization -> scroll to javascript files section -> in Excluded JavaScript Files input box add “script.crazyegg.com”

    It’s finally working now.

    Thank you so much for trying to help me!

    #1198938
    Tom
    Lead Developer
    Lead Developer

    Glad you got it working! 🙂

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.