# FB Pixel
- Set parameter
pixel
to the campaign or traffic source:
- Open the landing page in the Editor.
- Open
index.html
(orindex.php
). - Add between
<head>
and</head>
that code:
<script>
var date = new Date();
date.setTime(date.getTime() + (5 * 24 * 60 * 60 * 1000));
if (!'{pixel}'.match('{')) {
document.cookie = "pixel={pixel}; " + "expires=" + date.toUTCString() + "";
}
</script>
1
2
3
4
5
6
7
2
3
4
5
6
7
Example:
- Open the second file where the pixel must be added.
- Add that code:
<script>
var matches = document.cookie.match(new RegExp("(?:^|; )" + 'pixel' + "=([^;]*)"));
var pixel = matches ? decodeURIComponent(matches[1]) : undefined;
</script>
<!-- Facebook Pixel Code -->
<script>
!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window, document,'script',
'https://connect.facebook.net/en_US/fbevents.js');
fbq('init', pixel);
fbq('track', 'Lead');
</script>
<!-- End Facebook Pixel Code -->
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Example:
How to hide referrer?
Add that code between <head>
and </head>
:
<meta name="referrer" content="no-referrer">` между тегами `<head>...</head>
1