Many ad platforms, such as LinkedIn and Facebook, utilize tracking pixels to record conversions and attribute these to a campaign for performance reporting. Sometimes, you may want to activate the pixel only when a user has submitted a gate form. 


Generally, you should create only a single pixel and use this for all campaigns. The first half of this article explains how to activate a pixel on form submission. The second half covers the rare case where you may want to activate a different pixel for form submissions on specific gates only.


If you are using a tag manager such as Adobe TM or Google TM, and you are already raising GCDC events to your tag manager, then you should add the tracking pixel code within the tag manager. Alternatively, you can activate your pixel using GCDC's own event manager. To avoid duplicates, do not fire it from both places.


To configure GatedContent.com to fire the pixel follow the instructions below:

  1. Before starting ensure that you have the JavaScript code for your pixel.
  2. Paste the following line of code in the form submission section within the events manager in GatedContent.com.

The code below shows a generic example for activating a LinkedIn pixel:

var pixel = document.createElement('img');
pixel.src = "https://px.ads.linkedin.com/collect/?pid=******&conversionId=*******&fmt=gif";
pixel.height = 1;
pixel.width = 1;
pixel.style.display = "none";
document.body.appendChild(pixel);

You can test the pixel activation using preview mode, and if everything is working as expected then publish your changes. 


Firing pixels or other tracking code in response to specific form submissions only


Occasionally you may want to fire some tracking code only on certain gates. There are two main ways to achieve this:


  1. Within the event manager, conditionally execute JavaScript based on the current gate ID
  2. Add a gate editor field for gate editors to specify their own pixel ID, and then use this within your tracking code in the event manager


You should use option one when the conversion script differs substantially from any conversion script that is being fired on other gates, and you don't want gate editors to be able to control this directly. You should use option two if the only thing that differs between conversion script is a pixel ID, and you want gate editors to be able to specify their on IDs on a gate by gate basis.


Executing conversion script based on the gate ID


To execute a conversion script based on a specific gate ID, add this code at bottom of the submission event (replacing 'Gate_id_here' with the specific gate ID you want to execute the code on, and then the code itself within the condition statement):

if (gcdc.getValue("gateAttribute.gateId") === "Gate_id_here") { 
    // pixel code 
}

Overriding pixel IDs on a gate by gate basis

The steps to achieve this are slightly more complex but will allow gates editor to specify their own tracking pixel:


  1. Create a Gate editor field that will contain the pixel ID. You can call it something like 'LinkedIn pixel ID'. Publish this new field before proceeding to step 2.
  2. Within the event manager, modify your conversion code to use the value of this Gate editor field instead of a hard-coded value. You can inject the value of the gate editor field using the tool on the top right of the code editor within the event manager:



Got questions about conversion tracking? Email support@gatedcontent.com or click + New Support Ticket above.