This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async (event, steps) => { | |
// Validation request | |
if (event.query.challengeCode) { | |
const code = event.query.challengeCode; | |
const crypto = require('crypto'); | |
const hmac = crypto.createHmac('sha256', process.env.client_secret); | |
const response = hmac.update(code).digest('hex'); | |
$respond({ | |
status: 200, | |
headers: {}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
window.dataLayer = window.dataLayer || []; | |
function pushConversionEvent(CAPI_conversionRuleId, insightTag_conversionRuleId) { | |
// Generate unique event id that is passed to CAPI and Insight Tag for this instance | |
var unique_id = generateUUID(); | |
// Fetch form data elements safely | |
var emailElement = document.getElementById('email'); | |
if (emailElement) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
window.dataLayer = window.dataLayer || [] | |
function pushConversionEvent(CAPI_conversionRuleId, insightTag_conversionRuleId) { | |
// Generate unique event id that is passed to CAPI and Insight Tag for this instance | |
var unique_id = generateUUID(); | |
// Create the event object | |
var eventObject = { | |
event: 'CAPI Page View', // Replace your own event name if needed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
// Generate an unique, random event ID for CAPI event de-duplication based on uuid v4 algorithm | |
function generateUUID() { | |
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace( | |
/[xy]/g, | |
function (c) { | |
var r = (Math.random() * 16) | 0, | |
v = c == 'x' ? r : (r & 0x3) | 0x8 | |
return v.toString(16) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function li_fat_id_1p_data() { | |
// Function to get a cookie by name | |
function getCookie(name) { | |
var match = document.cookie.match(new RegExp('(^| )' + name + '=([^;]+)')); | |
if (match) { | |
return match[2]; | |
} | |
return ''; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function li_fat_id() { | |
// Function to get a cookie by name | |
function getCookie(name) { | |
var match = document.cookie.match(new RegExp('(^| )' + name + '=([^;]+)')); | |
if (match) { | |
return match[2]; | |
} | |
return ''; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function uuid() { | |
// UUID generator | |
// Private array of chars to use | |
var CHARS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split(''); | |
var chars = CHARS, uuid = new Array(36), rnd = 0, r; | |
// RFC4122v4 compliant uuid generator | |
for (var i = 0; i < 36; i++) { | |
if (i == 8 || i == 13 || i == 18 || i == 23) { | |
uuid[i] = '-'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Step 1 : Load Javascript library and helper function | |
// generate event ID using uuid function | |
const script = document.createElement('script') | |
script.src = 'https://cdn.jsdelivr.net/npm/uuid@8.3.2/dist/umd/uuidv4.min.js' | |
document.head.appendChild(script) | |
// load get cookie function | |
function getCookie(name) { | |
if (typeof document !== 'undefined') { | |
let matches = document.cookie.match( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/////////////////////////////////////// CAPI ////////////////////////////////////////// | |
// read the value from LinkedIn 1st party cookie li_fat_id | |
function getCookie(name) { | |
let matches = document.cookie.match(new RegExp( | |
"(?:^|; )" + name.replace(/([.$?*|{}()[\]\\/+^])/g, '\\$1') + "=([^;]*)" | |
)); | |
// usually a cookie value is encoded, so decode it. | |
return matches ? decodeURIComponent(matches[1]) : undefined; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/////////////////////////////////////// CAPI ////////////////////////////////////////// | |
// read the value from LinkedIn 1st party cookie li_fat_id | |
function getCookie(name) { | |
let matches = document.cookie.match(new RegExp( | |
"(?:^|; )" + name.replace(/([.$?*|{}()[\]\\/+^])/g, '\\$1') + "=([^;]*)" | |
)); | |
// usually a cookie value is encoded, so decode it. | |
return matches ? decodeURIComponent(matches[1]) : undefined; | |
} |
NewerOlder