Capturing GCLIDS in Slate (Google Ads Integration)
Overview
This documentation contains details about configuring an integration between Slate and Google to capture the Google click ID (GCLID) in Slate. It also includes instructions about integrating Slate and Zapier for the purpose of sending GCLIDs back to Google for offline conversion tracking. Before you begin, it’s recommended that you work with your marketing team to ensure the necessary configuration has been completed in Google Ads to enable offline conversion tracking. Typically, GCLIDs are captured from lead-generation or inquiry forms which are embedded in other webpages, such as your university website.
Capturing GCLIDs in Slate
Slate:
-
Create a new Person-scoped free-text field to capture the GCLID. I suggest naming it literally, “gclid.” Update the “Unsafe” setting to “Unsafe.”
-
Identify the form prospective students will be completing. (This is related to Step 1 in the “Google” section.)
-
On the form, add a new text box field. Label it something like “(hidden - gclid)” as this will be the hidden field that captures the GCLID. For an export key, input the name of your GCLID field, in this example, the export key is “gclid”.
-
In the same “Edit Field” screen, update the “Options” list to check “Hidden / accessible through script.”
-
Save the field.
-
On the form, click “Edit Rules” -> New Rule to add a new form rule. Call it something like “GCLID from form to field” or an otherwise descriptive name. The Rule Type is Field. Click save.
-
Under the Action section, select your GCLID field from the “Field” dropdown. Select “Replace Values from Formula” from the “Action” dropdown. Under Exports, export the hidden GCLID field that you added to your form in steps 3-4. In the Formula section, use the @ sign to add your gclid export. Save the rule.
-
Under “Edit Scripts/Styles”, you will need to add the following custom script. In the “var gclidFormFields” line, add the guid of the specific form you are wanting to capture GCLID from. (Where ‘form_” is, you would add your form GUID.)
function getParam(p) {
var match = RegExp('[?&]' + p + '=([^&]*)').exec(window.location.search);
return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
}
function getExpiryRecord(value) {
var expiryPeriod = 90 * 24 * 60 * 60 * 1000; // 90 day expiry in milliseconds
var expiryDate = new Date().getTime() + expiryPeriod;
return {
value: value,
expiryDate: expiryDate
};
}
function addGclid() {
var gclidParam = getParam('gclid');
var gclidFormFields = ['gclid_field', 'form_91a83459-4aa3-4579-951a-47cb367fc917']; // all possible gclid form field ids here
var gclidRecord = null;
var currGclidFormField;
var gclsrcParam = getParam('gclsrc');
var isGclsrcValid = !gclsrcParam || gclsrcParam.indexOf('aw') !== -1;
gclidFormFields.forEach(function (field) {
if (document.getElementById(field)) {
currGclidFormField = document.getElementById(field);
}
});
if (gclidParam && isGclsrcValid) {
gclidRecord = getExpiryRecord(gclidParam);
localStorage.setItem('gclid', JSON.stringify(gclidRecord));
}
var gclid = gclidRecord || JSON.parse(localStorage.getItem('gclid'));
var isGclidValid = gclid && new Date().getTime() < gclid.expiryDate;
if (currGclidFormField && isGclidValid) {
currGclidFormField.value = gclid.value;
}
}
window.addEventListener('load', addGclid);
-
Following these steps should enable you to begin capturing GCLIDs in your Slate instance. Capturing the GCLID is dependent on students submitting the form, so it could take some time before you begin to see GCLIDs stored in your instance. A great way to see if GCLIDS are coming in is to create a person-scoped CJ query, filtering for the existence of the GCLID field.
Slate-Side Troubleshooting:
-
If GCLIDs aren’t being captured in your instance:
-
Verify that the correct Slate form is embedded on the Google Ads landing page and that the form status is “Confirmed”
-
Ensure that the correct form GUID is updated in the script
Google-Side Troubleshooting:
-
Ensure that GCLID tracking is being done by your institution. Once you’ve verified that your institution is set up with Google Ads to track GCLIDS, identify which lead generation forms (this may be called something different at your institution, perhaps RFI Forms, Source Forms, or Ad Forms) are being used in the ads. Identify these forms in your Slate instance.
-
If you are doing offline conversion tracking, check with your Google Ads manager to make sure that the GCLIDs are getting back to Google and that conversion tracking is happening from the Google Ads side.
Instructions for Offline Conversion Tracking (sending the GCLID back to Google Ads using Zapier)
In Slate:
-
Create a new, CJ person-based query.
-
Filter for the existence of a gclid using your gclid field.
-
Export your gclid field.
-
Export the form submission date. You will use this as a “conversion date” for the Zapier job. Rename this to “conversion_date” or something similar. (You may need to join to a specific form or form folder to pick up the correct form.)
-
Click “Schedule Export.”
-
Under Destination, select “Web Service (Remote)”.
-
Under Endpoint, copy and paste the webhook from Zapier - if you haven’t done this yet, reference steps 2-5 in the Zapier section.
-
Skip Headers.
-
Under Notification, you may choose to setup a notification each time this query succeeds, fails, or delivers late. It’s recommended to set up a notification for “Successes, Failures, and Late Deliveries” at least for a short time at the beginning of the integration to ensure that everything is running as expected.
-
Under Format, select “JSON.”
-
Under Requested Delivery Window and Requested Weekdays, choose whatever schedule makes sense for your institution. High volume institutions might choose every delivery window and every weekday to ensure that the GCLIDS are sent to Google as soon as possible.
-
Under Requested Priority, select “Normal Priority.”
-
Click save.
-
Click “Edit Properties.”
-
Set the row limit to 1.
-
Yes, this does limit the query to only send one row at a time. At the time of this writing, the author had encountered issues with sending multiple GCLIDs in the same file, which is why we advise setting the row limit to 1. (If anyone finds a better way to do this, let us know!)
-
Reference Step 7 - if you need to go back and set up your Zapier webhook, do that now so you can run a test file to Zapier to use in the Zapier setup.
In Zapier:
-
If you do not have a Zapier account, you will need to create one for your area/institution. Zapier does offer a Free tier, but there are multiple paid tiers as well. Depending on your volume, a paid tier may be the best option for uninterrupted data transfer, as certain tiers limit how much you can do at a time.
-
Once your Zapier account is active, create a new Zap and name it something like “Google Offline Conversions” or something similar.
-
In the Zap setup, select “Webhooks by Zapier” and select the Trigger Event as “Catch Hook.”
-
Skip the section under Configure.
-
In the Test Section, copy the Webhook URL and paste it into the Endpoint in your Slate Query Schedule Export settings. (See the section “In Slate” for instructions on setting up the Slate query to send the gclid to Zapier.)
-
Click “Find New Records” and click “Continue with Selected Record.”
-
Add a section action and select “Google Ads” as your app. Select “Send Offline Conversion” as the Action Event, and make sure to link your Google Ads account. You will need login credentials to do this. Click continue.
-
In the Configure section, under “Use Google Ads as…” you will select the correct Google Ads account you want to send the offline conversions to. Some schools may just have one Google Ads account, but if you have multiple, make sure you are selecting the correct one. Skip the “Managed Account” field, unless this applies to you.
-
Under “Conversion User Identifier Source”, select “Google Click ID (GCLID)”. Under “Google Click ID (GCLID)”, map the source field of GCLID from your test file.
-
Skip “Order ID”.
-
Under Consent for ad User Data, select “Granted.”
-
Under Consent for ad personalization, select “Granted.”
-
Under “Conversion Action”, select “Form Fill.”
-
Under “Timestamp”, map the source field of conversion date from your test file.
-
Skip “Value.”
-
Skip “Currency.”
-
Click continue!
-
Use the “Test” section to test the webhook; you will be able to use your test file to send the data to Google. Zapier will tell you if the test succeeds or not in sending the data to Google Ads.
-
From this author’s experience, it takes some time for Google to provide offline conversion tracking data on these leads. Make sure you are checking in with your institution's Google Ads manager to see if any conversion tracking is available.
No Comments