Skip to content

Instantly share code, notes, and snippets.

Honey

<script src="https://www.cupertinojs.com/cupertino.js" 
        data-cupertino-global="cupertinoUid"></script>                        

<script>
// cupertino initialized and generated user identifier syncronously
document.write(window.cupertinoUid);
</script>
<html>
  <head>      
    <script src="https://www.cupertinojs.com/cupertino.js" 
            data-cupertino-global="<data-cupertino-global>"></script>
    <script src="https://cdn.optimizely.com/js/<OPTIMIZELY-PROJECT-KEY>.js"></script>
  </head>
  <body>
  </body>
<script src="https://www.cupertinojs.com/cupertino.js" 
        data-cupertino-global="cupertinoId"></script>
<script>
// pass into optimizely feature flag check
var enabled = optimizelyClientInstance.isFeatureEnabled('discount', cupertinoId);
</script>
<script src="https://www.cupertinojs.com/cupertino.js" 
        data-cupertino-defer="true"></script>

<script>
// if you need to defer ID generation for consent purposes
var cupertinoId = Cupertino();
  
// pass into optimizely feature flag check
var enabled = optimizelyClientInstance.isFeatureEnabled('discount', cupertinoId);
<script src="https://www.cupertinojs.com/cupertino.js" 
        data-cupertino-global="<String:null>"
        data-cupertino-defer="<Boolean:false>"></script>
parameter details required default
data-cupertino-global This will define the visitor identifier as a global variable no null
data-cupertino-defer Setting this to true will prevent Cupertino from generating an identifier automatically and will instead expose a global function Cupertino that can be called to return the identifier no false
{
"status": "ok",
"videos": [
{
"status": "ready",
"expires_date": null,
"description": "OLX CEO Fabrice Grinda thinks that value for entrepreneurship is in the execution of ideas, which is why good entrepreneurs will often steal ideas and just do them better.",
"title": "Why Good Entrepreneurs Borrow, Great Ones Steal",
"views": 0,
"tags": "Business, classifieds, dist-youtube, entrepreneurship, mashable video, mashable-video, startups, venture, venture studio, video",