Linkedin pixel in an integrated form code

SOLVE
lincé
Member

Hi,

Is there any possibility to ad the linkedin pixel in an integrated form code ?

I've personnalised my integration code with the google analytics event tracking and I'd like to ad the linkedin pixel to :

 <img height="1" width="1" style="display:none;" alt="" src="https://px.ads.linkedin.com/collect/?pid=XXXXXXX&conversionId=xxxxxxx&fmt=gif" /> 

For the moment, my integrated code looks like this :

<!--[if lte IE 8]>
<script charset="utf-8" src="//js.hsforms.net/forms/v2-legacy.js"> </script>
<![endif]-->
<script charset="utf-8" src="//js.hsforms.net/forms/v2.js" type="text/javascript"></script>
<script type="text/javascript">hbspt.forms.create({
	portalId: "XXXXXXX",
	formId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" ,
        onFormSubmit: function($form){
        gtag('event', 'action', {'event_category': 'category', 'event_label': 'label'});
},
});
</script>

Thanks in advance !

0 Upvotes
1 Accepted solution

Accepted Solutions
lincé
Solution
Member

Ok, I think I've found a solution :

<!--[if lte IE 8]>
<script charset="utf-8" src="//js.hsforms.net/forms/v2-legacy.js"> </script>
<![endif]-->
<script charset="utf-8" src="//js.hsforms.net/forms/v2.js" type="text/javascript"></script>
<script type="text/javascript">hbspt.forms.create({
	portalId: "XXXXXXX",
	formId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" ,
        onFormSubmit: function($form){
        gtag('event', 'action', {'event_category': 'category', 'event_label': 'label'});
        },
OnFormSubmit: function dropPixel (){
var imgtag = document.createElement('img');
imgtag.height = '1';
imgtag.width = '1';
imgtag.style = 'display:none;';
imgtag.alt = '';
imgtag.src='https://px.ads.linkedin.com/collect/?pid=XXX&conversionId=XXX&fmt=gif';
$("#item-content").append(imgtag);
} }); </script>

I thought the linkedin conversion was true only if the submission was made by a linkedin user who had joined the website via a link directly in linkedin but it seems to validate the submission even if the visitor used a direct access to the website...

 

Hope this could help others.

View solution in original post

1 Reply 1
lincé
Solution
Member

Ok, I think I've found a solution :

<!--[if lte IE 8]>
<script charset="utf-8" src="//js.hsforms.net/forms/v2-legacy.js"> </script>
<![endif]-->
<script charset="utf-8" src="//js.hsforms.net/forms/v2.js" type="text/javascript"></script>
<script type="text/javascript">hbspt.forms.create({
	portalId: "XXXXXXX",
	formId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" ,
        onFormSubmit: function($form){
        gtag('event', 'action', {'event_category': 'category', 'event_label': 'label'});
        },
OnFormSubmit: function dropPixel (){
var imgtag = document.createElement('img');
imgtag.height = '1';
imgtag.width = '1';
imgtag.style = 'display:none;';
imgtag.alt = '';
imgtag.src='https://px.ads.linkedin.com/collect/?pid=XXX&conversionId=XXX&fmt=gif';
$("#item-content").append(imgtag);
} }); </script>

I thought the linkedin conversion was true only if the submission was made by a linkedin user who had joined the website via a link directly in linkedin but it seems to validate the submission even if the visitor used a direct access to the website...

 

Hope this could help others.

View solution in original post