Skip to main content
All CollectionsTracking leads2) Tracking form submissions
Guide: How to track iFrames form submissions in SalesWings without Google Tag Manager
Guide: How to track iFrames form submissions in SalesWings without Google Tag Manager

In this guide, you will learn how to track website activities when your websites' forms are placed in iFrames (without GTM).

Salah from SalesWings avatar
Written by Salah from SalesWings
Updated over 2 years ago

If you are using iFrames on your website and you don’t use Google Tag Manager, you can integrate the tracking script manually by using the snippets of code below. There is one snippet for the outer frame and one for the iFrame.

Typical customization for the host page (outer frame):

<!-- SW HOST--> 
(function (g, a, b, c, d, e, i) {
g[d] = g[d] || function () {
(g[d].q = g[d].q || []).push(arguments);
};
g[d].l = 1 * new Date();
e = a.createElement(b);
i = a.getElementsByTagName(b)[0];
e.async = true;
e.src = c;
i.parentNode.insertBefore(e, i);
sw("init", {
pid: “put your project ID here",
debug: !0,
transport: "post",
clientSideCookie: "true",
binding: {
mode: "host",
selector: "iframe"
},
}, "trackPageviews");
sw("trackForms", {
mode: "submit"
});
})(window, document, "script", "https://s.saleswingsapp.com/sw.prod.min.js", "sw");
<!-- SW HOST-->

pid means Project ID. If you don’t know where to find your Project ID, please consult this guide.

Typical customization for the iFrame (internal frame):

<!-- SW GUEST --> 
(function (g, a, b, c, d, e, i) {
g[d] = g[d] || function () {
(g[d].q = g[d].q || []).push(arguments);
};
g[d].l = 1 * new Date();
e = a.createElement(b);
i = a.getElementsByTagName(b)[0];
e.async = true;
e.src = c;
i.parentNode.insertBefore(e, i);
sw("init", {
pid: "put your project Id here",
debug: !0,
transport: "post",
clientSideCookie: "true",
binding: {
mode: "guest",
trustedDomains: [“www.domain.com"] },
},
"trackPageviews");
sw("trackForms", {
mode: "submit"
});
})(window, document, "script", "https://s.saleswingsapp.com/sw.prod.min.js", "sw");
<!-- SW GUEST-->

Set the value of trustedDomains to the domain from which the outer frame is hosted.

Did this answer your question?