Welcome to the Instapage Support Center

|

LinkedIn conversion tracking

In order to track conversions that happen on your Instapage experience inside your LinkedIn account, you will need to add the following pieces of code in the indicated places.

The following code needs to be placed inside the Javascript > Body section of the landing page (only once per variation): 

<script type="text/javascript">
var bodyElement = document.getElementsByTagName('body')[0];

bodyElement.insertAdjacentHTML( 'afterbegin','<div id="addImage"></div>');

var addImage = document.getElementById('addImage');

function LinkedInConversion () {
addImage.innerHTML += '<img height="1" width="1" style="display:none;" alt="" src="https://px.ads.linkedin.com/collect/?pid=1234567&conversionId=1234567&fmt=gif" />';
}
</script>

The value between the quotes, after the addImage.innerHTML +=  part, is the one that you will need to replace so that it matches the pixel code of your LinkedIn account. The value is the HTML code, and it needs to be placed inside the quotes, exactly as in the above example. 

Screen_Capture_on_2019-09-25_at_19-49-55.gif

Screen_Shot_on_2019-09-25_at_19_53_46.png

Tracking form submissions as conversions:

Add the following code snippet in Javascript > Body under the first block of code. You do not need to edit anything else here, as the LinkedIn pixel is already edited in the first code snippet that is present at the top of this article.

<script type="text/javascript">
window.instapageFormSubmitSuccess = function( form ){
LinkedInConversion();
};
</script>

Tracking button clicks as conversions:

Add the following code snippet in Javascript > Body under the first block of code. You will need to edit the element ID of the button to match the ID of the particular button you are looking to track.

<script>
window.addEventListener('DOMContentLoaded', function () {
var element = document.querySelector("#element-123 .btn");
element.addEventListener("click", handler);
function handler() {
LinkedInConversion();
}
});
</script>

button_gif.gif

The implementation works only once per session (example: the visitor arrives on the page and performs an action - form submission or a button click - once the form is submitted or the button is clicked, the pixel will trigger and it will stay on the page). If the form is submitted again without the page being reloaded, the pixel will no longer trigger again. 

Have more questions? Submit a request
Was this article helpful?
0 out of 0 found this helpful

Need Further Help?

Tell us what you need and we will be happy to assist you.

Our team of expert support staff and our community can answer your questions. Submit a ticket, or reach out on live chat!