unomi-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Serge Huber <shu...@apache.org>
Subject Re: Javascript event help!
Date Thu, 28 Nov 2019 20:44:00 GMT
You're in luck I managed to quickly create a PR that adds support for the
identify() and track() methods. But all it does is send custom events to
Unomi, as there are no rules setup to handle the events they won't do
anything but if you setup the proper rules it can do anything you need!

I would love help with reviewing  the PR and possibly with the
documentation if this is useful to you.

You can find the PR here: https://github.com/apache/unomi/pull/115

Regards,
  Serge...

On Thu, Nov 28, 2019 at 8:36 PM Serge Huber <shuber@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.correia@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.doe@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 <rgauthier@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.correia@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.doe@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
>>>
>>

Mime
View raw message