On-Click Tracking

Overview

The On-Click Publisher Tag enables websites to track user interactions when traditional tracking links aren't available. This solution is specifically designed for publishers who serve links through JavaScript-powered interstitial pages or dynamic link generation.

💡 Key Benefit: Eliminates redirect delays while maintaining accurate click tracking through bounceless technology.

When to Use On-Click Tracking

Choose On-Click tracking when your website:

  • Serves CJ tracking links via JavaScript instead of direct HTML links

  • Uses interstitial pages to display offers before redirecting users

  • Requires dynamic link generation without pre-built tracking URLs

  • Needs to maintain user experience while preserving tracking accuracy

Prerequisites

Before implementing On-Click tracking, ensure you have:

  • Active CJ Publisher account with appropriate permissions

  • Access to your website's HTML <head> section

  • Ability to modify JavaScript code on tracking pages

  • Basic understanding of JavaScript functions (for technical implementation)

Implementation Steps

Step 1: Create Your On-Click Tag

  1. Log into your CJ Publisher account

  2. Navigate to Account > TRACKING > Publisher Tags

  3. Create a new On-Click tag type

  4. Record your PUBLISHER_CID and TAG_ID for the next steps

📋 Note: For detailed tag creation instructions, reference the Publisher Tag Overview.

Step 2: Add the Publisher Tag Script

Insert the CJ Publisher Tag into the <head> section of all pages that will use JavaScript-based CJ tracking links.


<!-- BEGIN CJ PUBLISHER TAG - DO NOT MODIFY --> 

<script 

type="text/javascript" 

src="https://www.p.zjptg.com/tag/{PUBLISHER_CID}/{TAG_ID}/"> 

</script> 

<!-- END CJ PUBLISHER TAG --> 

Important: Replace {PUBLISHER_CID} and {TAG_ID} with your actual values from Step 1.

Step 3: Modify Your JavaScript Navigation Code

Replace your existing navigation JavaScript with the new CJ function call:

Before (Original Code)


<script type="text/javascript"> 

window.onload = function() { 

var trackingLink = "https://www.anrdoezrs.net/click-99999-1234567?SID=12345x67890"; 

window.location.assign(trackingLink); 

} 

</script> 

After (Updated Code)


<script type="text/javascript"> 

window.onload = function() { 

var trackingLink = "https://www.anrdoezrs.net/click-99999-1234567?SID=12345x67890"; 

if(typeof cj !== 'undefined') { 

cj.navigate(trackingLink); 

} else { 

window.location.assign(trackingLink); 

} 

} 

</script> 

Key Code Components Explained

For Non-Technical Users:

  • The code checks if CJ's tracking system is ready

  • If ready, it uses the enhanced tracking method

  • If not ready, it falls back to the standard method

  • This ensures your links always work regardless of loading conditions

For Technical Users:

  • typeof cj !== 'undefined' validates the CJ object is loaded

  • cj.navigate() triggers the bounceless tracking technology

  • The fallback ensures graceful degradation if the CJ script fails to load

Integration Best Practices

Timing Considerations

  • Place the Publisher Tag script in the <head> before any tracking JavaScript

  • Execute tracking calls after the page fully loads to ensure CJ scripts are ready

  • Complete all necessary tasks (analytics, additional tracking) before calling cj.navigate()

⚠️ Critical: The cj.navigate() function immediately redirects users away from your site. Ensure all required tracking and analytics fire before this call.

Error Handling

Always include the fallback mechanism to maintain functionality:


if(typeof cj !== 'undefined') { 

cj.navigate(trackingLink); 

} else { 

// Fallback method ensures links still work 

window.location.assign(trackingLink); 

} 

Testing and Validation

Validation Checklist

  1. Code Verification
  • Removed original navigation JavaScript

  • Implemented cj.navigate() function calls

  • Added proper fallback handling

  1. Browser Testing
  • Open Developer Tools (Chrome: Ctrl+Shift+I)

  • Navigate to Network tab and start recording

  • Trigger the JavaScript tracking link

  • Click the tracking link

  1. Success Indicators
  • Network logs show "V1" entry with 200 status code

  • User successfully redirects to advertiser site

  • No JavaScript errors in console

Troubleshooting Common Issues

IssueSymptomSolution
CJ object undefinedFallback navigation triggersVerify Publisher Tag placement and CID/TAG_ID values
No V1 network requestMissing tracking dataCheck cj.navigate() function call syntax
Redirect failsUser stays on current pageVerify tracking link format and accessibility

Technical Support

If validation tests fail or you encounter integration issues:

  1. Verify all code changes match the examples provided

  2. Check browser console for JavaScript errors

  3. Confirm network requests show proper CJ tracking calls

  4. Contact CJ Support through your Account Support Center with specific error details

Next Steps

After successful implementation:

  • Monitor click-through rates and tracking accuracy

  • Consider implementing additional CJ tracking features

  • Review performance metrics in your CJ dashboard

  • Explore advanced tracking options for enhanced attribution