This article is also available in:

Custom Tracking Codes

Custom JavaScript (Tracking Codes)


Overview


The Custom JavaScript option allows you to integrate your own tracking or analytics scripts directly into your Drimify experience.
This is typically used for tools such as Facebook Pixel, Google Analytics, Google Tag Manager, or any other third-party service that requires a JavaScript snippet.
You will find this option in your project’s Settings panel, under Custom JavaScript.


⚠️ Important: Only client-side JavaScript is supported. Server-side or backend scripts cannot be used.


What You Can Use It For


You can use Custom JavaScript to:


  • Track page views and user behaviour
  • Trigger events when your experience loads
  • Integrate conversion tracking (e.g., Facebook Pixel events)
  • Connect your experience to analytics or marketing tools
  • Add custom logic on specific screens


This gives you full flexibility to connect Drimify to your preferred tracking ecosystem.


How to Add Your Script


  1. Open your project in the Drimify dashboard.
  2. Go to Settings.
  3. Scroll to the Custom JavaScript section.
  4. Paste your JavaScript code directly into the field.
  5. Ensure that the setting has been saved and publish your experience if not done already.


Your script will be automatically injected into your live experience.


Example: Facebook Pixel


Here is an example of a standard Facebook Pixel tracking script you could add:


<!-- Facebook Pixel Code -->
<script>
!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window, document,'script',
'https://connect.facebook.net/en_US/fbevents.js');
fbq('init', 'YOUR_PIXEL_ID');
fbq('track', 'PageView');
</script>


Replace YOUR_PIXEL_ID with your actual Facebook Pixel ID.


Tracking a Lead or conversion when someone registers


The Custom JavaScript runs once, when the experience loads. Drimify experiences are single-page apps: the address in the browser does not change from one screen to the next. So a script in this field, or a URL rule in Meta Events Manager, cannot see the moment a participant submits the registration form. Use one of these two set-ups instead.



  1. In the app's Integrations step, attach a webhook and turn on After form submission. The webhook fires each time a participant submits a form. See Configuring Webhook Integrations Within Your App.
  2. Point the webhook to your own endpoint or automation tool, and send each call to Meta as a Lead event through the Meta Conversions API (or the same kind of server-side API on your ad platform).


Keep the Pixel base code in Custom JavaScript to track visits to the game.


Option 2: the game is embedded on your website


Load the Pixel on your own page and fire the event from the callbacks of the HTML integration code (widget). onComplete fires when the participant reaches the last screen, so when your registration form comes before the end screen, each onComplete is a registered participant:


widget.onComplete = function (event) {
fbq('track', 'Lead');
};


For an Advent Calendar, Combo™ or Dynamic Path™, use onRouteChange and the end screen instead. See Advanced integration of the HTML integration code (widget) via the API.


Need the event at another step of your experience? Contact us through the live chat and our technical team will look at your set-up.


Execution Scope


  • Scripts are executed in the browser of the participant.
  • The script runs after the experience has loaded, ensuring compatibility with most analytics services.


Security Notes


  • Malicious or intrusive scripts are strictly prohibited.
  • Only use JavaScript obtained from trusted providers.
  • Scripts must comply with GDPR and other relevant privacy regulations.
  • You are responsible for informing participants about any tracking or data collection.


Troubleshooting


Your script isn’t firing?


  • Make sure your code is wrapped inside <script> tags if needed.
  • Ensure there are no syntax errors.
  • For event-based tracking, confirm that your event triggers are placed correctly.
  • Check your analytics platform to confirm whether the event was received.


Need Help?


If you are unsure how to integrate a specific script, contact your tracking provider (Facebook, Google, etc.) for instructions.
If you believe your script should work but doesn’t, feel free to contact our support team with details of what you’re trying to achieve.

Updated on: 26/10/2026

Was this article helpful?

Share your feedback

Cancel

Thank you!