Problem with custom TAG

Hi, how can i create a custom tag and give it the order details ?

And when i try to use postMessage, i have this error :
‘postMessage’ does not exist on ‘#page1


Thanks.

Please give some more details about tags that you want to use. Where are they going to be used and for which purpose?

In addition, postMessage() is used for communication between an embedded page and a parent page. Do you have an embedded element on a page that you’ve mentioned? Here is a reference for more information: https://www.wix.com/corvid/reference/wix-window.html#postMessage

Basicaly, i want to get the order details like the price and other stuff, and send theise informations with a script to an agency (not google).

Look at using Events from Wix Stores Backend or Thank you page.
https://www.wix.com/corvid/reference/wix-stores-backend.Events.html
https://www.wix.com/corvid/reference/$w.ThankYouPage.html

@givemeawhisky doesn’t work ! If i want to add Script in html with : createElement.

@ludovic

Firstly, note that Wix does not provide support for third party code that it has not had the chance to fully test themselves etc.
Wix 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. ***
https://support.wix.com/en/article/using-iframes-to-display-visible-content-on-your-site

You would need to do as Angelina stated already and use the html component to pass data.
https://www.wix.com/corvid/reference/$w.HtmlComponent.html
https://support.wix.com/en/article/corvid-working-with-the-html-element
You can see an example in the Wix Support page for Chart.js through html.

Another option you have got is to expose your site through 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

See here for an example.
https://www.wix.com/corvid/forum/corvid-tips-and-updates/example-myapi-and-myapiclient

Any JSON you get can be changed easily with stringify or parse.
https://www.w3schools.com/js/js_json_html.asp

This is not helpfull, i can’t belive we can add custom javascript in html with order’s data ! This is the worst tool i ever seen to create websites !

You can add custom js in html, it just has to be done through the html iframe as already stated above, or as a custom tool in Tracking and Analytics.
https://support.wix.com/en/article/embedding-custom-code-to-your-site

See this example here.
https://www.youtube.com/watch?v=3cZDwvHH7gw

Like A1webstats do with their own tracker code as shown here.
https://www.a1webstats.com/resource/add-javascript-to-wix-websites/


https://www.a1webstats.com/a1webstats-tracking-code-installation/