The Javascript is displayed over my head, but of course it should be among them.
It´s strange, because there are the adjustment options “Head”, “Body-Start” and “Body-End”, but the setting has no effect.
I need help thank you!
Best regards
Ludwig Holzapfel
You can’t embed HTML in a Corvid page. You might want to consider using an HtmlComponent . For more information, see the article Working with the HTML Component in Corvid .
A more secure way to handle web service requests is by using backend (server-side) code. Using backend code you can secure your passwords, API keys, and other secret information. The article Accessing 3rd Party Services explains how this is done. I recommend checking with the service provider to see if they provide a REST interface.
But on tracking tools i can embed the javascript. Only the position is wrong. When I enter the code here, I can choose the positions
Head
Body - start
Body - end
But without an effect.
Are your steps really necessary?
This is a screenshot, in german…
What do you mean by “the position is wrong?” Where is it supposed to go? You need to find out from the service provider where their script needs to be embedded.
You might be able to use an HtmlComponent . For more information, see the article Working with the HTML Component in Corvid .
My Javascript is displayed over my head. I can´t use it like this.
Then you probably need to use an HtmlComponent and place it wherever you want on the page.
Hi thank you yes i need exactly this. I studied the HtmlComponent the last days, but i need help.
I know i have to add a code in “Public” or “Backend” right?
But it is my first time i have to write or change a code. The original is like:
Can you tell me what i have to write more?
Regards
Ludwig
Okay, firstly you have been given a piece of html from your third party that they can use as a tracking tool.
Now that either goes onto a simple html iframe on your page, or the most used option is that you would be given two strips of code to use.
One that would go into the head section of a new tool in tracking and analytics and the other chunk that would simply go on your page in a html iframe.
https://support.wix.com/en/article/using-iframes-to-display-visible-content-on-your-site
https://support.wix.com/en/article/embedding-custom-code-to-your-site
However, as this code has come from a third party, Wix will not provide support for it as they have not had the chance to fully test it etc…
Important:
We cannot provide support for external codes that were not created or tested with Wix. If you are experiencing an issue with your code snippet, please contact the provider directly.
So, as Yisrael has pointed out already, you are best suited going back to your third party supplier of the code and asking them how they integrate it into Wix as they should be able to provide you with their own support for it.
Also, correct me if I am wrong, but it looks like you are using Immobilien.de from the script of ‘https://dev.fgimmobilien.de/js/api.js’ and as you can see in that line of code that they have their own API.
Therefore, you would be better and more secure to use their own API and they have their own support that you can contact about it too.
https://api.immobilienscout24.de/
https://api.immobilienscout24.de/our-apis.html
https://api.immobilienscout24.de/support.html
To use third parties with Wix you can simply use Wix Fetch or Wix HTTP functions.
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://www.wix.com/corvid/reference/wix-http-functions.html
https://support.wix.com/en/article/corvid-exposing-a-site-api-with-http-functions
1 Like
Although having a look at that script of https://dev.fgimmobilien.de/js/api.js
/* iFrame nach Script-Tag auf der Hauptseite einbinden */
var scriptElement = document.getElementById('fgIframe');
var apiKey = scriptElement.getAttribute('data-api')|| '';
var view = scriptElement.getAttribute('data-view')|| 'iframe';
var iframe = document.createElement('iframe');
iframe.src = 'https://dev.fgimmobilien.de/api.php?api_key=' + apiKey + '&view=' + view + '&url=' + document.location.href;
iframe.width = '100%';
iframe.height = '1000';
iframe.scrolling = 'no';
iframe.frameBorder = '0';
iframe.style = 'width: 100%;';
scriptElement.parentNode.insertBefore(iframe, scriptElement.nextSibling);
/*
Script um vom iFrame die Höhe auszulesen und im Dokument anzupassen
https://github.com/closingtag/super-awesome-responsive-iframe-solution/blob/master/iframe.html
*/
function receiveMessage(event) {
var message = event.data.split(':');
var eventName = message[0];
var iframes, len, i = 0;
// Domains to accept post messages from:
var senderDomains = ['https://dev.fgimmobilien.de'];
// Fix .indexOf in IE8
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function(obj, start) {
for (var i = (start || 0), j = this.length; i < j; i++) {
if (this[i] === obj) { return i; }
}
return -1;
}
}
if ( senderDomains.indexOf(event.origin) !== -1 && eventName === 'resize' ) {
iframes = document.getElementsByTagName('iframe');
len = iframes.length;
for (; i < len; i++) {
if ( ( iframes[i].contentWindow || iframes[i].documentWindow ) == event.source) {
iframes[i].style.height = message[1] + "px";
return;
}
}
}
}
if ( window.addEventListener ) {
window.addEventListener('message', receiveMessage, false);
}
else if (window.attachEvent) {
window.attachEvent('onmessage', receiveMessage);
}
Then you might need to do what Yisrael advises above too and use the HTML Component, as that way if your script doesn’t work then you can pass data to and from it yourself using the code for it.
How do I send data between my page and an HTML Component?
You can send and receive messages between your page and an HTML Component using the postMessage() and onMessage() functions.
If you use the links that Yisrael posted.
https://www.wix.com/corvid/reference/$w.HtmlComponent.html
https://support.wix.com/en/article/corvid-working-with-the-html-element
It explains to you how to work with the element and what code to use, plus if you look at the HTML Component link, then you can scroll down the samples and see a complete code sample for passing data to a page and receiving a confirmation.
Look at the onMessage() and postMessage() functions for it.
This is all done between the page and html component itself, nothing is done through the backend.
1 Like
Also, is that script supposed to be visible to all users as if not you can simply just try having the html iframe setup as hidden on load so that users won’t see it.
Plus, if you have used a html iframe then you should be able to move the box to where ever you want it to be on your page, it doesn’t have to be placed above your header.
However, if that is where it is placed when you have added it through a new tool in tracking and analytics, then you will need to go back to your third party supplier to get it sorted.
1 Like