developers:javascript-api:examples:introduction

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
developers:javascript-api:examples:introduction [2015/12/02 12:03]
178.83.199.102
developers:javascript-api:examples:introduction [2016/01/07 14:41] (current)
Line 66: Line 66:
 </​code>​ </​code>​
  
-The sample function is another masterpiece which easily allows generation of sampling information by visitor, session or page view.+The sample function is another masterpiece which easily allows generation of sampling information by consumer, session or page view.
 <code javascript>​ <code javascript>​
-duckprove.context.sample(duckprove.context.visitor(), 0.8)+duckprove.context.sample(duckprove.context.consumer(), 0.8)
 // Outputs: false // Outputs: false
 </​code>​ </​code>​
Line 74: Line 74:
 What's that useful for? Well, if you want to keep your reports really fast and don't need to collect that much information about a specific event or goal, it is an easy thing to just collect information about 20% of the users: What's that useful for? Well, if you want to keep your reports really fast and don't need to collect that much information about a specific event or goal, it is an easy thing to just collect information about 20% of the users:
 <code javascript>​ <code javascript>​
-if(duckprove.context.sample(duckprove.context.visitor(), 0.8)) {+if(duckprove.context.sample(duckprove.context.consumer(), 0.8)) {
   duckprove.values.create({ field: '​sampled_value',​ value: value });   duckprove.values.create({ field: '​sampled_value',​ value: value });
 } }