---
title: "Advanced embedding"
url: "https://docs.leaddoubler.com/en/article/advanced-embedding"
language: "en"
last_updated: "2026-04-14T13:44:40.957Z"
---

# Advanced embedding

Advanced instructions on how to embed your calculator directly on your website.

When embedding an iframe you have several inline options to enable/disable in the iframeResizer script.

Example with all inline options added:

```plaintext
<script class="ldScriptLoader" src="https://leaddoubler.s3.eu-west-1.amazonaws.com/files/ldScriptLoader.js" id="ldScript" iframesrc="{calculatorURL}" lazyLoad="true" urlCheck="" autoScroll="true" scrollOnLoad="false" offset="0" loadParams="true" postGA="" gaTracker="" dataLayerTracking="" gtagTracking=""></script>
```

## Options

* * *

| ### title |
| --- |
| **Description:**      <br>Adds the title attribute to the iframe |
| **Value:**      <br>`My iframe title` |
| **Default value:**      <br>`""` |
| **Full code example:**<br>```javascript<br>title="My iframe title"<br>``` |

| ### lazyLoad |
| --- |
| **Description:**      <br>Loading of the calculator will first occur when in view |
| **Value:**      <br>`true` or `false` |
| **Default value:**      <br>`true` |
| **Full code example:**<br>```javascript<br>lazyLoad="true"<br>                                                                        or<br>                                                                        lazyLoad="false"<br>``` |

| ### urlCheck |
| --- |
| **Description:**      <br>Only accepts ‘commands’ from the specified URL. E.g: "[http://myCalculator.beregner.net](http://mycalculator.beregner.net/)" |
| **Value:**      <br>`{URL}` |
| **Default value:**      <br>`""` |
| **Full code example:**<br>```javascript<br>lazyLoad="http://myCalculator.beregner.net"<br>``` |

| ### autoScroll |
| --- |
| **Description:**      <br>Automatically scrolls to top of calculator when navigating in quizzes |
| **Value:**      <br>`true` or `false` |
| **Default value:**      <br>`true` |
| **Full code example:**<br>```javascript<br>autoScroll="true"<br>                                                                        or<br>                                                                        autoScroll="false"<br>``` |

| ### scrollOnLoad |
| --- |
| **Description:**      <br>Automatically scrolls to calculator when parent page has been loaded |
| **Value:**      <br>`true` or `false` |
| **Default value:**      <br>`false` |
| **Full code example:**<br>```javascript<br>scrollOnLoad="true"<br>                                                                        or<br>                                                                        scrollOnLoad="false"<br>``` |

| ### offset |
| --- |
| **Description:**      <br>Numerical value: Used in combination with autoScroll so the page scrolls "offset" more or less. Usefull when having a fixed position banner to account for. |
| **Value:**      <br>`{offsetAmountInPx}` |
| **Default value:**      <br>`""` |
| **Full code example:**<br>```javascript<br>offset="300"<br>``` |

| ### loadParams |
| --- |
| **Description:**      <br>Automatically loads parameters from URL into the iframe on load, so the values can be used in the calculator. |
| **Value:**      <br>`true` or `false` |
| **Default value:**      <br>`true` |
| **Full code example:**<br>```javascript<br>loadParams="true"<br>                                                                        or<br>                                                                        loadParams="false"<br>``` |

| ### postGA |
| --- |
| **Description:**      <br>Activates the ability to post tracking data to Google Analytics through the iframe. |
| **Value:**      <br>`true` or `false` |
| **Default value:**      <br>`"false"` |
| **Full code example:**<br>```javascript<br>postGA="true"<br>                                                                        or<br>                                                                        postGA="false"<br>``` |
| **Example object to send directly from calculator (not from plug’n’play script):**<br>```javascript<br>var tracking = {<br>                                                                            hitType: 'event',<br>                                                                            eventCategory: 'My category',<br>                                                                            eventAction: 'My action',<br>                                                                            eventLabel: 'My label'<br>                                                                        }<br>                                                                        parent.postMessage(tracking, "*");<br>``` |

| ### gaTracker |
| --- |
| **Description:**      <br>If the parent page has multiple GA trackers, you can specify which one to send to. It defaults to just "send". If you provide "myCustomTracker", it will send data like: ga("myCustomTracker.send", objectFromPostmessage). |
| **Value:**      <br>`myCustomTracker` |
| **Default value:**      <br>`""` |
| **Full code example:**<br>```javascript<br>gaTracker="myCustomTracker"<br>``` |

| ### dataLayerTracking |
| --- |
| **Description:**      <br>Sends data from calculator to dataLayer on embedded page |
| **Value:**      <br>`true` or `false` |
| **Default value:**      <br>`"false"` |
| **Full code example:**<br>```javascript<br>dataLayerTracking="true"<br>                                                                        or<br>                                                                        dataLayerTracking="false"<br>``` |
| **Example object to send directly from calculator (not from plug’n’play script):**<br>```javascript<br>var tracking = {<br>                                                                            'event': 'my_event',<br>                                                                            'myCustomField': 'My value',<br>                                                                            'myCustomField2': 'My value',<br>                                                                        }<br>                                                                        parent.postMessage(tracking, "*");<br>``` |

| ### gtagTracking |
| --- |
| **Description:**      <br>Sends data from calculator to `gtag()` on embedded page |
| **Value:**      <br>`true` or `false` |
| **Default value:**      <br>`"false"` |
| **Full code example:**<br>```javascript<br>gtagTracking="true"<br>                                                                        or<br>                                                                        gtagTracking="false"<br>``` |
| **Example object to send directly from calculator (not from plug’n’play script):**<br>```javascript<br>var tracking = {<br>                                                                            'event': 'my_event',<br>                                                                            'extra': {<br>                                                                                event_category: 'My category',<br>                                                                                event_label: 'My label'<br>                                                                            }<br>                                                                        }<br>                                                                        parent.postMessage(tracking, "*");<br>``` |

| ### **cookieInformation** |
| --- |
| **Description:**      <br>Can be used to sends data from the calculator to a Cookie Information configured site when on embedded on a page |
| **Value:**      <br>`true` or `false` |
| **Default value:**      <br>`"false"` |
| **Full code example:**<br>```javascript<br>cookieInformation="true"<br>                                                                        or<br>                                                                        cookieInformation="false"   <br>``` |

| ### **dynamicFields** |
| --- |
| **Description:**     <br>Can be used to load the calculator with data from the embedded page.  <br>Logic id from the calculator is defined, and the selector to fetch the value from.   <br>  <br>In the example, the 'loanAmount' field will be prepopulated by the numeric value from the '.suggested-price' element on the embedded page.  <br>  <br>Useful if you have a landing page where you display a house price, and want the calculator on the same page to have the house price as the default value in the loan amount. |
| **Value:**      <br>logicId:selector,logicId2:selector |
| **Full code example:** |
| ```javascript<br>dynamicFields="loanAmount:.suggested-price"<br>``` |

## Plug’n’play script for simple tracking

* * *

To use the following tracking script, you need to add it to your calculator in the "[Analytics code](https://docs.leaddoubler.com/en/article/calculator-editor-overview#insert-custom-html)":

```html
<script id="ldTrack" eventCategory="prisberegner" eventAction="started" eventLabel="dataindsamling" trackOnLoad="false" trackingType="GA4/ga/gtag/dataLayer" src="https://leaddoubler.s3-eu-west-1.amazonaws.com/files/ldTrack.js" measurementId="" apiSecret="" eventName=""></script>
```

-   When using "[dataLayer](https://docs.leaddoubler.com/en/article/advanced-embedding#datalayertracking)" and "[gtag](https://docs.leaddoubler.com/en/article/advanced-embedding#gtagtracking)", specify the "event" in the `eventAction` parameter. 
-   When using "**GA4**", specify `measurementId`, `apiSecret`, `clientId` and `eventName`. The parameters with "event" in the nam are not used.

## Extra

* * *

To scroll into view, you can with javascript call `resizeNotify("top")` from the calculator. This method is automatically called in “quiz mode” and when calculator is loaded on parent page.
