The JDX Function is the heart of the pixel. It allows you to control when, what, and how things are sent to our system. There function is divided into three separate types of uses:
- Request: Sends a request to our system
- Config: Sets up the pixel configurations for every request that follows
- Option: Sets the options on the next request made and will be reset following its completion
The jdxtag()
function’s first argument is the action it will take and is followed by any required or optional parameters needed for that action:
jdxtag(<ACTION>, <PARAMETERS>)
The type of actions available for the JDX Function are:
_conversion
, _track
, options
, metadata
, and config
. See the details for each action below for the specific parameters required.
Ensure that when using the jdxtag()
function on an HTML page you have it wrapped in a <script>
tag or no action will be made.
Request
There are two types of requests you can make to our servers:
- Conversion
- Track
Each request allows you to report metrics into our system so we can keep track of how jobs are performing for you. These numbers can used for publisher payments as well as figuring out how to plan your campaigns.
Requests accept options as a second parameter. The possible options are laid out in the table below:
Track Parameters v1
Option | Description |
---|---|
jobId | This is the job's unique identifier. This identifier is the one we imported from your system so it should align with the one you are using on your website. This identifier is also available when we redirect a user. We include it under the query parameter jdx_jid. |
clickId | For every user we redirect to your website we generate a click id for them. This value is sent to you on redirect under the query parameter jdx_click. If you can, save this value and send it when you make a conversion or track request. Sending this value is the best way to ensure accuracy of the data |
Conversion
Tracking conversions for your job is done using the _conversion
parameter. Whenever you get an applicant make sure to send a request to our system so it can be reflected in our reporting. A _conversion
request is executed like so:
jdxtag('_conversion', { jobId: 'id-AF3FE01', clickId: 'bcf8a0f3-df81-42eb-b744-5beb27583df7' })
A _conversion
request takes an optional parameter object as the second argument. Within the options parameter you can pass the job identifier as jobId
and/or the click identifier clickId
. Passing one or both of these parameters is preferable as it improves reporting accuracy.
Track
If you would like user tracking as far as what pages they visit and determining sponsored versus unsponsored traffic you can use a _track
request. This reports a visit to our system for the page the user is currently on which is used when generating page analytics. For general pages there is no second argument needed:
jdxtag('_track')
When you are making a request from a job page you need to pass the jobId
to let us know the page belongs to a job. This allows us to verify sponsored versus unsponsored traffic. It also accepts the clickId
we send on redirect. The more parameters you can include the more accurate the reporting will be.
jdxtag('_track', { jobId: 'id-AF3FE01', clickId: 'bcf8a0f3-df81-42eb-b744-5beb27583df7' })
Config
Our pixel maintains a global config that persists for every request you make on a page. Typically you’ll set Config variables in the
<head>
tag (see the Head Snippet section for an example of config usage) so that any requests made from the tag on the page will include your config changes. However, you can update the config from anywhere, just note that jdxtag()
function calls happen in order so any config changes applied only alter subsequent requests.
The Config action takes a variable name as the second parameter and a third parameter with the value you want to set that variable to. Depending on the variable, there may be additional parameters. Refer to the documentation on specific config variables for proper usage.
Config actions include:
- Set Pixel
- Pixel Time Zone
- Do Not Track
Set Pixel
This config action is mandatory and must be set before making any requests. This variable accepts a string value which is your pixel’s UUID. To find the UUID our system has assigned to your account please visit the platform, log into your dashboard, and visit the account’s pixel page.
jdxtag('config', '_setPixel', 'bdc609ea-9675-402f-ac5d-130ce1bfc4a5')
Pixel Time Zone
This config action is mandatory and must be set before making any requests. This variable accepts a string value which is the timezone you specified when you created your account. To see what this variable is for your account please visit the platform, log into your dashboard, and visit the account’s pixel page.
jdxtag('config', '_pixelTimeZone', 'EST')
Do Not Track
If you allow users to opt out of being tracked you can set their decision by passing a boolean value to the Do Not Track action. If set to true then requests will not be sent to our system. In order to stay flexible we’ve left how you keep track of a user’s Do Not Track status up to you. Just make sure whenever they go to a new page the status is re-affirmed.
jdxtag('config', '_doNotTrack', true)
If you want requests to be sent but you do not want to send user data, please use the Ignore Params action to turn off what is being tracked on your users.
Options
When making requests there are times where you want to make adjustments on how the data is being sent to our system. We provide various Option actions to give you flexibility. Note that unlike Config actions, these actions do not persist between requests. If you want to make multiple requests with the same options you’ll need to re-apply them before each request is made.
Option actions include:
- Current URL
- Referrer URL
- Ignore Params
Current URL
This action allows you to override the browsers current URL. Some practical uses of this option could be:
- That you have sensitive URL parameters that you don’t want sent to us
- Your website is a Single Page App (React, Angular, etc) and it doesn’t update the browser’s internal URL
- Your website uses AJAX and/or modals and you want distinct URLs and/or parameters sent to our system
This option accepts a string which you can enter the URL of the current page the user is visiting.
jdxtag('options', '_currentUrl', 'http://www.your-website.com/route/page')
Referrer URL
If you need to override the referrer URL because the one stored in the browser is not accurate you can use the Referrer URL action. This is especially important for Single Page Apps (React, Angular, etc) that do not update the referrer URL at all. If you want to accurately track how users are navigating your website you will need to make sure the referrer URL being passed to our system is correct.
jdxtag('options', '_referrerUrl', 'http://www.your-website.com/route/referrer-page')
Ignore Params
Our pixel tracks various user attributes we get from the browser. This is useful for tracking user behaviour. However, there may be instances where you do not want certain data tracked on your user. To have the pixel ignore certain browser attributes use the Ignore Params action and pass an array of attributes (as strings) that you want ignored.
jdxtag('options', '_ignoreParams', ['_userAgent', '_browser'])
Optimize Pixel Ignore Params v1
Param | Description | Example |
---|---|---|
_userAgent | The specific browser with version being used by a user | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:88.0) Gecko/20100101 Firefox/88.0 |
_browser | The browser of the user | Chrome |
_mobile | A boolean value as to whether they are on mobile | TRUE |
_screenSize | A width by height string value of the browser's screen size in pixels | 1600x900 |
_color | An integer with the color depth on the user's browser | 24 |
_referrer | The URL that the user came from before the current page | http://www.website.com/route/page |
_encoding | The character set on the user's browser | UTF-8 |
_language | The native language set on the user's browser | en-US |
_location | The current URL that the user is on | http://www.website.com/route/page |
_timezone | The timezone that the user's browser is in | America/New York |
Note that if you want to add multiple ignore params you must add them all at once. Any additional calls of the Ignore Params action will overwrite the previous values:
Problematic:
jdxtag('options', '_ignoreParams', ['_language', '_color'])
jdxtag('options', '_ignoreParams', ['_timezone'])
// Now only _timezone will be ignored, the _language and _color will still be present in the request!
jdxtag('_conversion', 'jid-1AFO3')
Good:
jdxtag('options', '_ignoreParams', ['_language', '_color', '_timezone'])
// Now all three parameters will be ignored in the request!
jdxtag('_conversion', 'jid-1AFO3')
Metadata
If you need additional information attached to a request so you can better understand or organize your data, you can use the Metadata action. When using this action you also must include a key and a value which will be stored by Optimize. Note that the key and the value must both be of type String and the key must only include alphanumeric characters (_ and – also allowed as separators) in order to be valid:
jdxtag('metadata', 'a_key-example', 'A string value')
There is a maximum of 5 metadata parameters allowed per request, and you must make sure to run the metadata functions before you run the desired request:
// Set metadata
jdxtag('metadata', 'job-type', 'Sales')
jdxtag('metadata', 'company', 'Widget Corp')
// Then send request!
jdxtag('_track', 'company', 'Widget Corp')