Skip to content

Commit

Permalink
feat: Add leadfeeder script for company tracking for the test purposes
Browse files Browse the repository at this point in the history
  • Loading branch information
Dejan Zec authored and Dejan Zec committed Aug 29, 2024
1 parent b576ce1 commit 499a04d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/components/layout/leadfeeder-script.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { useEffect } from 'react';

const LeadfeederScript = () => {
useEffect(() => {
const script = document.createElement('script');
script.innerHTML = `
(function(ss,ex){
window.ldfdr=window.ldfdr||function(){(ldfdr._q=ldfdr._q||[]).push([].slice.call(arguments));};
(function(d,s){
var fs=d.getElementsByTagName(s)[0];
function ce(src){
var cs=d.createElement(s);
cs.src=src;
cs.async=1;
fs.parentNode.insertBefore(cs,fs);
};
ce('https://sc.lfeeder.com/lftracker_v1_'+ss+(ex?'_'+ex:'')+'.js');
})(document,'script');
})('ywVkO4XqrWdaZ6Bj');
`;
document.head.appendChild(script);

return () => {
document.head.removeChild(script);
};
}, []);

return null;
};

export default LeadfeederScript;
2 changes: 2 additions & 0 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
} from '../types';
import { IGatsbyImageData } from 'gatsby-plugin-image';
import { StructuredOrganizationData } from '../components/pages/landingpage/structured-organization-data';
import LeadfeederScript from '../components/layout/leadfeeder-script'; // Import the new component

export interface OfficeImage {
relativePath: string;
Expand Down Expand Up @@ -72,6 +73,7 @@ export const Head = ({ data, location }: PageProps<IndexPageQueryProps>) => {
locales={data.locales}
/>
<StructuredOrganizationData />
<LeadfeederScript />
</>
);
};
Expand Down

0 comments on commit 499a04d

Please sign in to comment.