Interesting Issue: Third Party Script Only Working on Desktop site

I have added a third party script to a client’s wix site to facilitate call tracking (a special phone number masks the site’s hardcoded number based on referral source). I have done this on many other wix sites without issue. However, in this particular case, the script is only firing on the desktop version and is failing on mobile.

Desktop version = correct number display

Mobile version = incorrect number display


Below is how the script was added:

  1. In your Wix account, add a custom code to your website.
    a. Paste the script from your CTM account into the field provided.
    b. Make sure to choose to add code to all pages and select Load code on each new page.
    c. Select to place the code in the Head section.

  2. Create a second custom code in Wix.
    a. Paste the following script into the field provided:

    b. Make sure to choose to add code to all pages and select Load code on each new page.
    c. Select to place the code in the Body – end section.

Here is the explanation of the problem from CTM (the third party call tracking software):

What we have found is Wix is serving up different HTML when on mobile which wraps the phone numbers in an tag. We do not look inside the object tags. We reviewed the page source & still see the object tag. I have attached a screenshot for reference.


Any thoughts on if this is the issue/how to fix it?

So you have entered your html code as per like this.
https://support.wix.com/en/article/embedding-custom-code-to-your-site

With a piece of code set up as custom in the tracking and analytics which is set up to load on all pages and is placed in the Head section. Then you are doing the same again only this time placing the custom code in the Body section instead.

As for fixing it, your only real choice is to go back to CTM and ask them to help rewrite the html code for you to use it within Wix as Wix themselves would not provide help for third party code and they are not going to change their way of working with html code in desktop or mobile just to make this code work for CTM.

https://support.wix.com/en/article/guidelines-and-limitations-of-the-html-code-and-embed-a-site-elements
Important: We are unable to provide support for external HTML codes that are added to Wix sites as the codes have not been tested by Wix.We recommend testing your code before you publish.

I’ve used html codes before and have had them working fine with a piece of code going into a custom tool like yours in the tracking and analytics and placing it in the head section.

However, I have always had to place the second piece of html code into the page itself through a html iframe, I’ve never had to place both sets of html code into the tracking and analytics section.

You say that you have used it many times before on different Wix sites without issues, is this the exact same piece of code from CTM or has it been different code that you have used.

Also, are all the Wix websites that you have implemented this on been set up in the same way as in theory, if you say you have used it before many times, then it should work exactly the same on this Wix website too.

Are you able to test it on another Wix website or do you have access to another clients website where you have already implemented this to see if it is still working on theirs too.

Either that or see if you can use CTM API if they have one and use Wix Fetch or HTTP functions.

Thanks for the comments. Lots to digest:

  • Because this is masking an existing element in the site (rather than adding a new element… like a submission form), I didnt think of needing an iframe. How could that help in this situation?
  • The CTM code is the exact same that i have used in the past
  • Im not sure if this Wix site was set up the same way as previous sites i have worked with. What are potential differences in configuration that would cause variations in how the script is run (specifically desktop vs. mobile)?
  • I do have access to another Wix site and the code is firing as intended for both mobile and desktop versions.

Yes I’ve been having a look myself at CTM and seen the Wix install page and yes you have to add both blocks of code as described into the tracking and analytics section.
https://www.calltrackingmetrics.com/support/numbers/dynamic-numbers/tracking-code/1641577-installing-the-tracking-code-on-wix-sites/

Although as I mentioned before, I’m used to having one piece of code in the tracking and analytics section with the other piece of code going into a html iframe on the actual page, like as suggested here with tracking number through CTM.
https://www.calltrackingmetrics.com/products/integrations/wix/

The thing that gets me is that you have used the same setup on different Wix websites that were all premium and not free, otherwise this feature would not work on free Wix websites.

So, as long as you have not just copied and pasted the same code from a previous Wix site as each number is dynamically linked to that code, then in theory it should work exactly the same as you’ve said it has on other Wix websites.
“Do not copy the resulting code and try to embed or load it from another site. The code is dynamic. Changes made to tracking number, tracking sources, and target numbers on the CTM platform may cause the code to change to reflect the new configuration. A copy of the code will not be dynamically updated, and as a result number swapping will not work as expected.”

If you think about it, if this one doesn’t work then previous ones shouldn’t work, although thinking about it now, were these previous sites made up before Wix had the Wix Turbo upgrade around March/April time. However, if it was the Wix Turbo update that now puts the html code on mobile devices into am object tag, then it should really do the same to all the other Wix websites that you now view on a mobile device.

Unless, Wix have set it up so that some changes were only affecting websites made up after the Wix Turbo upgrade, so that all existing websites still function properly.

However, as it looks like you now can’t use the code in Wix due to the html on mobiles putting things in object tags, I would just double check your other Wix website that you say works fine and see if hat is set up in the same way with regards to how the telephone numbers are inserted onto each website’s page.

Are they simply both just a text box with the number into it, or does one website have a telephone number being displayed from a dataset if that website has a public area in a repeater for example, as this could possibly affect how things are coded in the html.

Anyways, I would go back to CTM and see if they can suggest anymore help to yourself regarding this matter, although they do state that they don’t support you if you are using this option within Wix, this is exactly the same with Wix’s response of not supporting people with html from a third party too.

So i would suggest, or recommend as it will be a more secure way of doing it, to use their Rest API and call this function through using Wix Fetch.
https://postman.calltrackingmetrics.com/?version=latest#intro
https://github.com/calltracking/calltracking.github.io/blob/master/api_users_guide.md
https://www.wix.com/corvid/reference/wix-fetch.html
https://support.wix.com/en/article/corvid-accessing-third-party-services-with-the-fetch-api
https://support.wix.com/en/article/corvid-calling-server-side-code-from-the-front-end-with-web-modules

Yes it will mean a lot more work and you will have to rethink your working for integrating CTM into your Wix websites from now on, however unless you can get Wix to not put things in object tags when using the website on mobile devices, then you have no option other than not to use it until CTM can find a suitable alternative and a fix, or to not use it and to find a suitable alternative.

I would suggest contacting Wix Support too.
https://support.wix.com/en/article/contacting-wix-support

Tell them your issues with CTM now not working with Wix websites as per the instructions you have got from CTM to install it.

Plus, how it has worked on other made up Wix websites previously, probably best to give them a list of previous websites that it works still on to so that they can view it themselves.

They won’t probably answer your issue themselves and they might pass it onto the relevant department for you, so that you can get at least a suitable answer as to why it has now supposedly changed and why you now can’t use it sa CTM suggest.

Or they might just redirect you back here to the Wix Code Forum and tell you that it is not their problem to help you with it.

thanks givemeawhisky! Ill keep the forum posted on my findings/progress