Skip to content

Instantly share code, notes, and snippets.

@demandbaselabs
Last active January 2, 2016 21:39
Show Gist options
  • Save demandbaselabs/8365097 to your computer and use it in GitHub Desktop.
Save demandbaselabs/8365097 to your computer and use it in GitHub Desktop.
Demandbase Segmentation Engine Implementation Sample
<html>
<head>
</head>
<body>
<script type="text/javascript">
var __db = {};
__db.key = 'YOUR_KEY_HERE';
__db.conditions = [
{ name: 'IndustryIsSoftware', attribute: 'industry', operator: '=', value: 'Software & Technology' }
,{ name: 'AudienceIsSMB', attribute: 'audience', operator: 'equals', value: 'SMB', standalone: false }
,{ name: 'AudienceIsEnterprise', attribute: 'audience', operator: 'equals', value: 'Enterprise' }
,{ name: 'CountryIsJapan', attribute: 'country', operator: '=', value: 'JP', standalone: false}
,{ name: 'RegCountryIsJapan', attribute: 'registry_country_code', operator: '=', value: 'JP', standalone: false }
,{ name: 'RevSize_SweetSpot', attribute: 'revenue_range', operator: '!=', value: ['$1 - $1M', '$1M - $5M', '$5M - $10M'] }
,{ name: 'EESize_EntOrMM', attribute: 'employee_range', operator: '=', value: ['Small', 'Mid-Market'] }
];
__db.segments = [
{ name: 'SMB_Software', rules: ['IndustryIsSoftware', 'AudienceIsSMB'], operator: 'and' }
,{ name: 'SweetSpotOrSoftware', rules: ['RevSize_SweetSpot', 'IndustryIsSoftware'], operator: 'any' }
,{ name: 'GEO_JP', rules: ['CountryIsJapan', 'RegCountryIsJapan'], operator: 'or' }
];
__db.callback = function(args) {
Demandbase.utils.log('Running page-level callback extender');
//Content customization code goes here!
//Add any function calls or other code here to be run after the Demandbase Company Profile is available
//'company' argument is equivalent to Demandbase.Segments.CompanyProfile
};
(function() {
db = function (){(db.q=db.q||[]).push(arguments)};
var dbt = document.createElement('script'); dbt.type = 'text/javascript'; dbt.async = true;
dbt.id = 'demandbase-sdk';
dbt.src = ('https:'==document.location.protocol?'https://':'http://')+'scripts.demandbase.com/demandbase-sdk.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(dbt, s);
})();
</script>
<div id="demandbase_content"></div>
<img src="" id="test_img1"/>
<img src="" id="test_img2"/>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment