What does it do?
The Lead Capture Script grabs the information submitted by the user on the landing page form or Drift chatbot and sends it to the platform. The lead's information can be found in the Converted Lead table. This script is designed to work only with landing pages of "Lead Generation" campaigns. The landing page should be set up within the Metadata's Campaign Wizard that includes field mapping. Email is the required field.
Before starting:
- Lead Capture Script will grab all fields from the form that are mapped in the metadata landing page offer.
- The script will capture all fields that can be found on the landing page based on the name attribute. If fields can't be found then you may need to manually map them by inspecting the field element and copying the field name element.
- Does the script contain any cookies? Yes, cookies are used to store the metadata_cid in the situation where the page URL changes and drops the metadata_cid from the address bar.
- For landing pages with a Drift chatbot, the script will only grab the email address when a User enters it during the chatbot journey.
- Ensure the Lead Capture Script is installed on the landing page with the form and it works properly. Without this, converted leads information will not get pushed to the platform.
- Our Lead Capture Script out of the box doesn't work with iframes since they are different pages that doesnt know about our script.
- Work arounds include: Callback Event, Manually triggering our script
- Please reach out to support@metadata.io if you need help with this
- Event pages such as Zoom, on24.com, Calendly are not supported. A workaround is to create a Lead Gen Form offer and link directly to the event form.
How does it look?
You can copy the metadata tracking code by going here and clicking settings for Metadata App and clicking copy for the Lead Capture script
<script>
(function(options) {
var s = document.createElement("script");
s.async = true;
s.src = "https://cdn.metadata.io/site-script.js";
s.onload = function() {
window.Metadata.siteScript.init(options);
};
document.head.appendChild(s);
})({ accountId: ACCOUNT_ID });
</script>
How to embed it?
The Metadata tracking code should be embedded into the Landing page directly or via any Tag Manager across all pages or the specific landing page you plan to run Landing Page campaigns.
To install navigate here and select the option to install the Lead Capture script:
Validate successfully installed:
Navigate to the landing page domain where the script has been installed.
Right click to inspect the elements of the page or open Developer tools. In the elements search for "metadata.io/site-script.js"
If you are able to successfully search for "metadata.io/site-script.js" the script has been successfully loaded.
Next, check to make sure the metadata_cid cookie is loaded as well. To do this, add to the domain landing page URL metadata_cid=1234, for example: https://metadata.io/?metadata_cid=1234
Open Developer tools again and navigate to Applications -> cookies -> select the landing page domain cookies and search for metadata_cid. If the cookie has been successfully loaded the script is adding it successfully.
From the Metadata platform, after creating a Landing Page offer you may also test by submitting a test lead to ensure the lead is captured after placing the lead capture script:
Troubleshooting:
- If you are unable to find the site-script.js / metadata_cid there could be several different reasons why
- If the website has a consent policy, it may be blocking our script / cookie from being loaded.
- Check the console tab for any errors related to CSP where our domain may be blocked and may need to be whitelisted.
- Check to make sure the script was successfully deployed if using tag manager as the change may not have been published.
- If the script still fails to load please reach out to support@metadata.io
Manually Trigger Lead Capture Script:
Depending on the landing page, in some scenarios, our Lead Capture Script can be manually triggered if a custom form is being used that is not triggering on submit.
- The script will need to be inserted into the landing page and be present to trigger our API script which is contained inside the .js file.
- When testing, the metadata_cid will need to be present in the URL. As a test, you can manually insert the metadata_cid into your URL, e.g. metadata.io/?metadata_cid=1234.
- If you open the console and enter Metadata.siteScript you can start interacting with the script.
- To send data from a form, use window.Metadata.siteScript.sendFormData(formEl), where formEl is the form DOM element. For raw data, use: window.Metadata.siteScript.sendData({email: 'test@test.com'})
- Debugging: Use window.Metadata.siteScript.getAllFields() to show all form fields the site script is aware of.
Callback Event:
As an example, if you are using an iframe and it allows you to inject a script into the iframe you can setup a callback event that gets posted back to the parent page that our script is listening for.
See this article: https://metadatasupport.zendesk.com/hc/en-us/articles/36998595614484-Pardot-Forms-Lead-Capture where an example is provided on how to setup a Callback Event on completion of the form for Pardot form specifically.
The solution would be similar to other forms; a script would need to be created that would post the same message back to the parent page along with the form details.
Thank You Page Ad Channel Tracking Pixel:
For Landing Page campaigns, the native conversion pixel needs to be placed on the thank you page after a lead converts so that conversions can be tracked accurately on the native channels.
Are cookies used?
|
Cookie name |
Importance |
Description / Usage |
Expiration |
Provenance |
|---|---|---|---|---|
|
Metadata_cid |
Critical |
Stores in the browsers session cookies the metadata_cid (unique campaign ID from metadata).
Used for conversion tracking purposes to see where the Lead originally originated from after clicking an Ad from a Metadata campaign.
The cookie will only be added if the Lead originated from a Metadata campaign and the Lead script is triggered.
|
30 days |
Third-party |
|
Metadata_cid_history |
Low |
Stores the history of the metadata_cid and when it was created.
The history will store any previous metadata_cid's from the visitor from any past campaigns they visited from Metadata campaigns. |
90 days |
Third-party |
Site Visitors Pixel:
For more information, please read All about: Site Visitors Pixel.
Help and Support: Please email support@metadata.io if you're running into any issues.
Comments
0 comments
Article is closed for comments.