Last active
June 1, 2023 16:27
-
-
Save DevinVinson/e305e2e0f5ea147635a9ed57d5a41007 to your computer and use it in GitHub Desktop.
Custom Event with full data
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
// REPLACE THIS WITH THE CAMPAIGN'S ID | |
var campaignId = 'XXXXXX'; | |
document.addEventListener('tp.Main.EventListener.Ready', function () { | |
var event = new CustomEvent('tp.Custom.Submit', { | |
bubbles: true, | |
cancelable: true, | |
detail: { | |
widgetId: campaignId, | |
fields: [ | |
{ key: "location", value: { city: "", region: "", country: "" } }, | |
{ key: "firstName", value: "Billy" }, | |
{ key: "email", value: "[email protected]" }, | |
{ key: "page", value: "https://yoursite.com/path/of/url/page-submitted-on/" }, | |
{ key: "conversionId", value: "1234" } // Generate or use a unique ID to help stop duplciate entries | |
] | |
} | |
}); | |
document.dispatchEvent(event); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment