Last active
October 13, 2023 06:32
-
-
Save jamesmills/45b7624958d83d734d6083dbf764680a to your computer and use it in GitHub Desktop.
Extracting the AnyTrack Click ID to append to the LeadByte Custom Form integration.
This file contains 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> | |
AnyTrack(function() { | |
// Extract atclid once AnyTrack script is loaded | |
var atclid = AnyTrack('atclid'); | |
var c1 = "7 Facebook Ad Tips"; | |
// Append AnyTrack Click ID to LeadByte form url | |
var url = new URL(window.location.href); | |
var search_params = url.searchParams; | |
search_params.set('atclid', atclid); | |
search_params.set('c1', c1); | |
url.search = search_params.toString(); | |
// The new url string | |
var new_url = url.toString(); | |
window.history.pushState({ path: new_url }, '', new_url); | |
// Load LeadByte form | |
var s = document.createElement('script'); | |
s.id = 'lb_form'; | |
s.type = 'text/javascript'; | |
s.async = true; | |
s.src = 'https://forms.leadbyte.co.uk/load.js?lbform48=62970168f5b53f43b2e9f91fc8555fc5'; | |
document.body.appendChild(s); | |
}); | |
</script> | |
<div id="lbform48" style="width: 10px; min-width: 100%; height: 600px;"></div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment