system-prompts-and-models-o.../dealix/landing/posthog_snippet.html
2026-05-01 14:03:52 +03:00

100 lines
4.2 KiB
HTML

<!--
Dealix — PostHog Analytics Snippet
Insert BEFORE </head> in index.html, marketers.html, pricing.html, partners.html
Replace YOUR_POSTHOG_KEY with your actual project key.
Get it from: https://app.posthog.com/settings/project → Project API Key
-->
<script>
!function(t,e){var o,n,p,r;e.__SV||(window.posthog=e,e._i=[],e.init=function(i,s,a){function g(t,e){var o=e.split(".");2==o.length&&(t=t[o[0]],e=o[1]),t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}}(p=t.createElement("script")).type="text/javascript",p.async=!0,p.src=s.api_host.replace(".i.posthog.com","-assets.i.posthog.com")+"/static/array.js",(r=t.getElementsByTagName("script")[0]).parentNode.insertBefore(p,r);var u=e;for(void 0!==a?u=e[a]=[]:a="posthog",u.people=u.people||[],u.toString=function(t){var e="posthog";return"posthog"!==a&&(e+="."+a),t||(e+=" (stub)"),e},u.people.toString=function(){return u.toString(1)+".people (stub)"},o="init capture register register_once register_for_session unregister unregister_for_session getFeatureFlag getFeatureFlagPayload isFeatureEnabled reloadFeatureFlags updateEarlyAccessFeatureEnrollment getEarlyAccessFeatures on onFeatureFlags onSessionId getSurveys getActiveMatchingSurveys renderSurvey canRenderSurvey identify setPersonProperties group resetGroups setPersonPropertiesForFlags resetPersonPropertiesForFlags setGroupPropertiesForFlags resetGroupPropertiesForFlags reset opt_in_capturing opt_out_capturing has_opted_in_capturing has_opted_out_capturing clear_opt_in_out_capturing startSessionRecording stopSessionRecording sessionRecordingStarted captureException loadToolbar get_property getSessionProperty createPersonProfile opt_in_session_recording opt_out_session_recording has_opted_in_session_recording has_opted_out_session_recording clear_opt_in_out_session_recording is_session_recording_enabled getSessionId debug".split(" "),n=0;n<o.length;n++)g(u,o[n]);e._i.push([i,s,a])},e.__SV=1)}(document,window.posthog||[]);
posthog.init('YOUR_POSTHOG_KEY', {
api_host: 'https://us.i.posthog.com',
person_profiles: 'identified_only',
capture_pageview: true,
capture_pageleave: true,
// Dealix-specific config
loaded: function(posthog) {
// Auto-tag all Dealix pages
posthog.register({
source: 'dealix_landing',
locale: 'ar-SA',
});
// Track CTA clicks
document.querySelectorAll('a[href*="calendly"]').forEach(function(el) {
el.addEventListener('click', function() {
posthog.capture('cta_calendly_click', {
page: window.location.pathname,
text: el.textContent.trim().substring(0, 50),
});
});
});
// Track pricing tier interactions
document.querySelectorAll('[data-tier]').forEach(function(el) {
el.addEventListener('click', function() {
posthog.capture('pricing_tier_click', {
tier: el.dataset.tier,
});
});
});
// Track partner application
document.querySelectorAll('form[data-track="partner_apply"]').forEach(function(form) {
form.addEventListener('submit', function(e) {
posthog.capture('partner_application_submit', {
path: new FormData(form).get('path') || 'unknown',
});
});
});
// Track scroll depth
var scrollMilestones = [25, 50, 75, 100];
var reported = {};
window.addEventListener('scroll', function() {
var pct = Math.round((window.scrollY + window.innerHeight) / document.documentElement.scrollHeight * 100);
scrollMilestones.forEach(function(m) {
if (pct >= m && !reported[m]) {
reported[m] = true;
posthog.capture('scroll_depth', { percent: m, page: window.location.pathname });
}
});
});
}
});
</script>
<!--
Custom events to fire from your app code:
1. Form submission:
posthog.capture('demo_requested', {
company: document.querySelector('[name=company]').value,
path: 'A' // or B, C
});
2. Pilot start (backend → frontend):
posthog.capture('pilot_started', {
plan: 'pilot',
amount: 1
});
3. Payment success:
posthog.capture('payment_succeeded', {
plan: 'starter', // or growth, scale
amount: 999,
currency: 'SAR'
});
4. Identify user (after signup):
posthog.identify(user.email, {
name: user.name,
company: user.company,
plan: user.plan,
saudi: true
});
-->