Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #78254

    Mark p
    Participant

    I need to embed a javascript code snippet into the footer which doesn’t seem to be functioning properly. The code snippet is a call tracking tracking seen below:

    <!– start number replacer –>
    <script type=”text/javascript”><!–
    var vs_account_id = “xxxxxx_xxx”;
    //–></script>
    <script type=”text/javascript” src=”http://website.com/number-changer.php”>
    </script>
    <!– end ad widget –>

    Can you let me know where, how to embed this code to function properly? Thanks!

    #78456

    Kosher K
    Member

    hi there,

    please add this code below in your active child theme functions.php

    function addfooter_script() { ?>
    <!– start number replacer –>
    <script type=”text/javascript”><!–
    var vs_account_id = “xxxxxx_xxx”;
    //–></script>
    <script type=”text/javascript” src=”http://website.com/number-changer.php”>
    </script>
    <!– end ad widget –>
    <?php
    }
    add_action('wp_footer','addfooter_script');

    Cheers

    #87070

    Mark p
    Participant

    Hi and thanks for the response.

    I tried adding it the the child theme and it’s still not working. Is there some other advice you can give me? Not being able to track our calls because of some weird javascript blocking is a significant issue.

    #87084

    Kosher K
    Member

    Hi There,

    Can you please provide url of your site.

    Did you make sure you’ve added the code to your current active child theme?

    You can also provide login access to your site so we can check it.

    Cheers

    #87100

    Mark p
    Participant
    This reply has been marked as private.
    #87104

    Nabeel A
    Moderator

    Hey Mark,

    Have you tried embedding the code via Customize > Custom > Javascript. Just copy and paste your code in Javascript box and let us know how this goes!

    #87157

    Mark p
    Participant
    This reply has been marked as private.
    #87336

    Paul R
    Moderator

    Hi Mark

    The file on your javascript code returns a 404 – File or directory not found.

    http://website.com/number-changer.php

    #87619

    Mark p
    Participant

    That’s not the real url, I was posting it to a forum that I couldn’t set to private (for that specific post) so I changed the URL and account id neither of which should matter since the code is accurately placed on the website.

    #87685

    Kosher K
    Member

    Hi Mark,

    I’m really confuse about your issue,

    1. Can you please provide the exact javascript code you want to add on the footer?

    I noticed this script <script type="text/javascript" src="http://1196.xg4ken.com/media/number-changer/voicestar/number-changer.php"></script> has been added 4 times on your page. and I’m not sure what did you do to have that added 4 times.

    2. I’ve seen the previous code working properly adding your script at the footer, can you tell us what really your issue?

    You can see this code If you view the page source

    <script type="text/javascript">var vs_account_id="CtjSaFKPUut_NACm";</script>
    <script type="text/javascript" src="http://1196.xg4ken.com/media/number-changer/voicestar/number-changer.php"></script>
    #87711

    Mark p
    Participant
    This reply has been marked as private.
    #87755

    Kosher K
    Member

    Hi Mark,

    I think you should first try adding the script one time only and not 4 times.

    I can see this page http://mastermechanicauto.com/auto-air-conditioning/?_vsrefdom=p.640 has also 4 the script.

    Also, you might want to try disabling your caching plugin and other plugin you installed not associated with X as I can see few errors in the console.

    Additionally, I really don’t know how that script works and how it should suppose to change an element into something without even targeting that specific element. I can’t even think that would be possible unless you assign some class or some selector to your phone number that correspond to your script

    Can you provide additional information on how that supposed to change something with only the script provided need to be added on the page for us to help and diagnose about this issue.

    Thanks

    #89568

    Mark p
    Participant

    I removed all other places the code is placed and still, it’s not functioning the way it should be. I’ve used other themes that didn’t cause this type of conflict so I know it has to do with the theme itself. I disabled the plugin and that did not help either. This is essentially how it works – https://support.callrail.com/hc/en-us/articles/201051406-Installing-Dynamic-Number-Insertion

    #89645

    Rad
    Moderator
    This reply has been marked as private.