var keen = new Keen({ projectId: "5796907c36bca46e0d3ecaf8", writeKey: "a6f32e0edb770a9336c923ff16e23a32fe7527f5a079dac8c398828d77dc122123fec6e4a263f10be37ca47236a62133c0028439045d76eeec9a36fc3f332f135172e42880414676872b406b732327c0893ba8e01d5e9b8dcbc0ca36e813f3ef" }); $('.keen-click-track').on('click', function(){ var clickEvent = { detail: $(this).attr("data-keen-detail"), ip_address: "${keen.ip}", user_agent: "${keen.user_agent}", keen: { addons: [ { name: "keen:ip_to_geo", input: { ip: "ip_address" }, output: "ip_geo_info" }, { name: "keen:ua_parser", input: { ua_string: "user_agent" }, output: "parsed_user_agent" } ] } }; keen.addEvent($(this).attr("data-keen-event"), clickEvent, function(err, res){ if(err) { console.log("keen click tracking error"); } }); });