Hi Serge, Thanks! Maybe I can help build this ... I downloaded all source code and tried to build it but it says it can't find package.json. I think if I get the environment to build I'll be able to add the code necessary to track events.
Can you provide some direction here? joaocorreia@Joao-Correia-Macbook web-tracker % yarn build *yarn run v1.19.2* error Couldn't find a package.json file in "/Users/joaocorreia/Git/unomi/extensions/web-tracker" info Visit *https://yarnpkg.com/en/docs/cli/run <https://yarnpkg.com/en/docs/cli/run>* for documentation about this command. joaocorreia@Joao-Correia-Macbook web-tracker % -- *João Correia* San Diego, CA mobile: +1 (858) 284-6010 web: https://joaocorreia.io On Thu, Nov 28, 2019 at 11:36 AM Serge Huber <shu...@jahia.com> wrote: > Hello Joao, > > Unfortunately I just check the integration and it is not complete for the > track method nor the identify methods. You can see this in this file: > > > https://github.com/apache/unomi/blob/master/extensions/web-tracker/javascript/src/analytics.js-integration-apache-unomi.js > > You'll see the ontrack method only works for forms right now, and the > identify doesn't send the event (it's commented out). > > Actually we even have an old PR for the identify : > https://github.com/apache/unomi/pull/73/files > > I think we might want to merge this but we might want to check if the > structure is correct. > > In the meantime you could always call the event collector using an AJAX > request but it would be better to have the analytics.js code to do that. > > Regards, > Serge Huber. > Serge Huber > CTO & Co-Founder > T +41 22 361 3424 > 9 route des Jeunes | 1227 Acacias | Switzerland > jahia.com <http://www.jahia.com/> > SKYPE | LINKEDIN <https://www.linkedin.com/in/sergehuber> | TWITTER > <https://twitter.com/sergehuber> | VCARD > <http://www.jahia.com/vcard/HuberSerge.vcf> > > > > JOIN OUR COMMUNITY <http://www.jahia.com/> to evaluate, get trained and > to discover why Jahia is a leading User Experience Platform (UXP) for > Digital Transformation. > > > On Wed, Nov 27, 2019 at 5:47 PM João Correia <joao.corr...@gmail.com> > wrote: > >> Hi Romain, >> >> I can send a page view but I would like to send an event. On 3.4 it is >> mentioned that the tracker is an integration of analytics.js. If you visit >> https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/ >> you >> can see the track method, which unomiTracker also seems to have. >> >> I just wanted to send an event not a pageview. >> >> Im using Clearbit to enrich who is visiting, so when Clearbit finished I >> would like to send an event with some properties just like it is done >> through the curl -X POST http://localhost:8181/eventcollector \ but >> using the unomiTracker. >> >> I've worked with Segment before and this is how their tracker works. If >> you go to their website console and type: analytics.track("MyCraZyEvent", >> properties,) this will fire an event. >> >> What am I missing here? >> >> The track method lets you record any actions your users perform. You can see >> a track example in the guide >> <https://segment.com/docs/tutorials/quickstart-analytics.js#step-3-track-actions> >> or >> find details on the track method payload >> <https://segment.com/docs/connections/spec/track>. >> >> track method definition: >> >> analytics.track(event, [properties], [options], [callback]); >> >> >> 3.4. WEB TRACKER >> >> This extension is providing the web tracker to start collecting visitors >> data on your website. The tracker is implemented as an integration of >> analytics.js <https://github.com/segmentio/analytics.js> for Unomi. >> >> curl -X POST http://localhost:8181/eventcollector \ >> -H "Content-Type: application/json" \ >> -d @- <<'EOF' >> { >> "sessionId" : "1234", >> "events":[ >> { >> "eventType":"contactInfoSubmitted", >> "scope": "example", >> "source":{ >> "itemType": "site", >> "scope":"example", >> "itemId": "mysite" >> }, >> "target":{ >> "itemType":"form", >> "scope":"example", >> "itemId":"contactForm" >> }, >> "properties" : { >> "firstName" : "John", >> "lastName" : "Doe", >> "email" : "john....@acme.com" >> } >> } >> ] >> } >> EOF >> >> >> Thanks >> Joao >> >> -- >> >> *João Correia* >> >> San Diego, CA >> mobile: +1 (858) 284-6010 >> web: https://joaocorreia.io >> >> >> >> >> >> >> >> >> >> >> >> >> >> On Wed, Nov 27, 2019 at 2:34 AM Romain Gauthier <rgauth...@jahia.com> >> wrote: >> >>> Hello Joao, >>> >>> To send the page views, the tracker has a .page method, you can section >>> 3.4.3 here: https://unomi.apache.org/manual/latest/#_tracking_page_views >>> >>> >>> You can also check the example that is deployed with Unomi: >>> http://localhost:8181/tracker/ >>> >>> To identify a user, you can check the doc on the login event, I think >>> it's where you'll have the best information: >>> https://unomi.apache.org/manual/latest/#_how_to_send_a_login_event_to_unomi >>> The idea is to register a rule in Unomi that will react on the login >>> events and ensure that all events and properties associated with a profile >>> based on cookie are merged with the ones that belong to the named / >>> authenticated profile. >>> >>> I don't know if the "identify" method of the tracker has actually been >>> mapped to any inner logic in Unomi, if it's not the case, that looks like a >>> great thing to do. >>> >>> Romain >>> >>> >>> >>> On Wed, 27 Nov 2019 at 07:57, João Correia <joao.corr...@gmail.com> >>> wrote: >>> >>>> Hi Unomiers, >>>> >>>> Discovered Unomi yesterday and got it set up today!. Works nicely on >>>> pageviews but I would like to fire a identify or event to identify the >>>> profile. >>>> >>>> I'm having trouble sending events using the JS tracker. This is how I'm >>>> trying sending an event: >>>> >>>> properties = >>>> { >>>> "eventType":"Whatsup", >>>> "scope": "example", >>>> "source":{ >>>> "itemType": "site", >>>> "scope":"example", >>>> "itemId": "mysite" >>>> }, >>>> "target":{ >>>> "itemType":"form", >>>> "scope":"example", >>>> "itemId":"contactForm" >>>> }, >>>> "properties" : { >>>> "firstName" : "John", >>>> "lastName" : "Doe", >>>> "email" : "john....@acme.com" >>>> } >>>> } >>>> >>>> window.unomiTracker.track("MyEvent", properties); >>>> >>>> I look at the network tab and Im also on unomi:event-tail and nothing >>>> comes through. Also tried identify it goes into local storage but doesn't >>>> get sent. >>>> >>>> window.unomiTracker.identify({ >>>> nickname: 'Amazing Grace', >>>> favoriteCompiler: 'A-0', >>>> industry: 'Computer Science' >>>> }); >>>> >>>> Does anyone have any examples of how to fire an event using the >>>> Javascript Tracker? >>>> >>>> Thanks >>>> Joao Correia >>>> >>>> -- >>>> >>>> *João Correia* >>>> >>>> San Diego, CA >>>> mobile: +1 (858) 284-6010 >>>> web: https://joaocorreia.io >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>> >>> -- >>> Romain Gauthier >>> Product Manager at Jahia >>> + 33 6 20 18 35 25 >>> 8 Rue du sentier | 75002 Paris | France >>> >>