### Dynamic Group By Implementation Example Source: https://docs.calibermind.com/agent-cal/widget-builder-sql-style-guide A complete SQL query example demonstrating the integration of dynamic grouping. Note that the widget title must contain '{{groupBy}}' for this to function. ```SQL select {{groupBy:cm_companystats.industry_short|cm_companystats.company_region|cm_campaign.campaign_type|cm_companystats.company_fit|cm_companystats.customer_status}} as _dimension, sum(touch_value) as _measure, 'Opps Attributed: '||count(distinct opp_Id) as _hover_label from cm.cm_insights_attribution left join cm.cm_companystats using (company_id) left join cm.cm_campaign on cm_campaign.cm_id = cm_insights_attribution.campaign_id where default_model = true group by all ``` -------------------------------- ### Full Drift Installation and AnalyticsJS Integration Source: https://docs.calibermind.com/onboarding/using-analytics-js-with-drift This example demonstrates the complete implementation, including the Drift initialization snippet followed by the custom event listener for email capture tracking. ```JavaScript ``` -------------------------------- ### Install CaliberMind AnalyticsJS Page Tracking Snippet Source: https://docs.calibermind.com/article/wjllq90om7-how-to-install-analytics-js-and-track-page-views This JavaScript snippet initializes the AnalyticsJS tracker for your website. It should be placed in the of every page you wish to track. It asynchronously loads the necessary scripts and can be configured with ABM vendors. Ensure you replace '{{WRITE_KEY_HERE}}' with your actual write key. ```javascript !function(){var e=window.analytics=window.analytics||[];if(!e.initialize)if(e.invoked)window.console&&console.error&&console.error("MetaRouter snippet included twice.");else{e.invoked=!0,e.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","debug","page","once","off","on","addSourceMiddleware","addIntegrationMiddleware","setAnonymousId","addDestinationMiddleware"],e.factory=function(t){return function(){var o=Array.prototype.slice.call(arguments);return o.unshift(t),e.push(o),e}};for(var t=0;t (function(w,q){w['QualifiedObject']=q;w[q]=w[q]||function(){ (w[q].q=w[q].q||[]).push(arguments)}})(window,'qualified') // This is the main Qualified JS script // This is the new function to add immediately after the Qualified JS script ``` -------------------------------- ### Full Qualified and AnalyticsJS Implementation Source: https://docs.calibermind.com/article/zkl630zt1p-using-analytics-js-with-qualified A complete example showing the initialization of the Qualified object, the loading of the Qualified script, and the event handling logic required to sync data with AnalyticsJS. ```javascript ``` -------------------------------- ### SQL for Pivoted Chart Data Source: https://docs.calibermind.com/agent-cal/widget-builder-sql-style-guide Shows an example of SQL output shaped for pivoted data in charts. This format assumes each column represents a unique series and requires an '_xaxis' column for the x-axis definition. ```sql SELECT date_column AS _xaxis, SUM(CASE WHEN series_column = 'Series A' THEN value_column ELSE 0 END) AS "Series A", SUM(CASE WHEN series_column = 'Series B' THEN value_column ELSE 0 END) AS "Series B" FROM your_table GROUP BY _xaxis; ``` -------------------------------- ### Install Identify Snippets for Form Tracking Source: https://docs.calibermind.com/system-configuration/how-to-install-analytics-js-and-track-page-views Identify snippets are used to capture user identity from form submissions. Separate versions are provided for standard HTML forms and HubSpot-hosted websites. ```html ```