var tamber = require('tamber')('Mu6DUPXdDYe98cv5JIfX');
tamber.event.track({
user: "user_rlox8k927z7p",
behavior: "purchase",
item: "item_83jx4c57r2ru",
getRecs: {}
}, function(err, result) {
if (err) {
console.log("Request failed with error: " + err);
} else {
console.log(result);
}
});
package main
import (
tamber "github.com/tamber/tamber-go"
"github.com/tamber/tamber-go/discover"
"github.com/tamber/tamber-go/event"
"fmt"
)
func main() {
tamber.DefaultProjectKey = "Mu6DUPXdDYe98cv5JIfX"
tamber.DefaultEngineKey = "SbWYPBNdARfIDa0IIO9L"
e, info, err := event.Track(&tamber.EventParams{
User: "user_rlox8k927z7p",
Behavior: "purchase",
Item: "item_83jx4c57r2ru",
GetRecs: &tamber.DiscoverParams{},
})
for _, rec := range *e.Recs {
fmt.Printf("Item Id: %s, Score: %f\n", rec.Id, rec.Score)
}
}
#import <Tamber/Tamber.h>
[Tamber setUser:@"user_rlox8k927z7p"];
TMBEventParams *params = [TMBEventParams eventWithItem:@"item_83jx4c57r2ru" behavior:@"purchase"];
[[Tamber client] trackEvent:params responseCompletion:^(TMBEventResponse *object, NSHTTPURLResponse *response, NSString *errorMessage) {
if(errorMessage){
// Handle error
}
}];
require 'tamber'
Tamber.project_key = 'Mu6DUPXdDYe98cv5JIfX'
Tamber.engine_key = 'SbWYPBNdARfIDa0IIO9L'
begin
e = Tamber::Event.track(
:user => 'user_rlox8k927z7p',
:behavior => 'purchase'
:item => 'item_83jx4c57r2ru',
:get_recs => {}
)
e.recommended.each { |rec| puts "item: #{rec.item}, score: #{rec.score}"}
rescue TamberError => error
puts error.message
end
$ curl https://api.tamber.com/v1/event/track \
-u Mu6DUPXdDYe98cv5JIfX: \
-d user=user_rlox8k927z7p \
-d behavior=purchase \
-d item=item_83jx4c57r2ru \
-d getRecs='{}'
import com.tamber.Tamber;
import com.tamber.exception.TamberException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONObject;
import org.json.JSONException;
public class TamberExample {
public static void main() {
Tamber tamber = new Tamber("Mu6DUPXdDYe98cv5JIfX", "SbWYPBNdARfIDa0IIO9L");
HashMap<String, Object> eventParams = new HashMap<String, Object>();
eventParams.put("user", "user_rlox8k927z7p");
eventParams.put("item", "item_83jx4c57r2ru");
eventParams.put("behavior", "purchase");
eventParams.put("getRecs", new HashMap<String, Object>());
JSONObject resp = new JSONObject();
try {
JSONObject resp = tamber.event.track(eventParams);
} catch (TamberException e) {
System.out.println(String.format("%s=%s", e.getClass().getName(), e.getMessage()));
}
if (resp != null) {
try {
System.out.println(resp.toString(4));
} catch (JSONException e) {
System.out.println(String.format("%s=%s", e.getClass().getName(), e.getMessage()));
}
} else {
System.out.println("resp did not return");
}
}
}
import tamber
tamber.project_key = 'Mu6DUPXdDYe98cv5JIfX'
tamber.engine_key = 'SbWYPBNdARfIDa0IIO9L'
e = tamber.Event.track(
user='user_rlox8k927z7p',
behavior='purchase',
item='item_83jx4c57r2ru',
getRecs={}
)
for rec in e['recommended']:
print "item:%s score%s\n" % (rec['item'], rec['score'])
// add this to your html header
<script type="text/javascript">
var s=document.createElement("script");s.type="text/javascript",s.src="https://js.tamber.com/1.1.0/tmb.min.js",s.async=!0,document.getElementsByTagName("head")[0].appendChild(s),s.onload=s.onreadystatechange=function(){
window.tamber = window.tamber("Mu6DUPXdDYe98cv5JIfX");
window.tamber.setTrackGuests(true);
};
</script>
// call tamber
window.tamber.event.track({
user: "user_rlox8k927z7p",
item: "item_83jx4c57r2ru",
behavior: "purchase",
context: {
"page": "homepage",
"section": "featured_section"
}
});