You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@unomi.apache.org by João Correia <jo...@gmail.com> on 2019/12/05 18:06:49 UTC

Javascript Tracker Page! properties

Hi Unomiers,

Im looking to enrich a profile with some properties like CompanyDomain,
Employees and others. Im trying to do this with the JS tracker by sending a
pageview with properties but they aren't showing up on Unomi.

I'm sending this:

path = "/cb";
properties = {
      path: path,
      attributes : ["test1"],
      pageInfo: {
        destinationURL: location.href,
        tags : [ "tag1", "tag2", "tag3"],
        categories : ["category1", "category2", "category3"],
      },
      interests : {
        "interest1" : 1
        ,"interest2" : 2
        ,"interest3" : 3
      },
      attributes: [ "testattribute" ],
      properties : {
         "CompanyDomain": "Igloo Analytics"
        ,"CompanyEmployees" : "1-10"
      }
};

//console.log(properties);
window.unomiTracker.page(properties);

In the profile I see the event below.
Why aren't the properties I sent showing up? Any ideas?

       {
            "itemId": "c600f6c5-ed0d-438f-bd29-5a2ac744446b",
            "itemType": "event",
            "scope": "aaa",
            "version": 1,
            "eventType": "view",
            "sessionId": "44ca434d-35ce-5c14-a9bc-35cac9fe943c",
            "profileId": "30ba35a2-c7cb-42d9-a58c-5569ab2d34ec",
            "timeStamp": "2019-12-05T18:02:44Z",
            "properties": {},
            "source": {
                "itemId": "aaa",
                "itemType": "site",
                "scope": "aaa",
                "version": null,
                "properties": {}
            },
            "target": {
                "itemId": "/cb",
                "itemType": "page",
                "scope": "aaa",
                "version": null,
                "properties": {
                    "attributes": [],
                    "consentTypes": [],
                    "interests": {
                        "interest1": 1,
                        "interest3": 3,
                        "interest2": 2
                    },
                    "pageInfo": {
                        "destinationURL": "https://www.xxxxx.com/",
                        "categories": [
                            "category1",
                            "category2",
                            "category3"
                        ],
                        "pageID": "/cb",
                        "pagePath": "/cb",
                        "pageName": "xxx: xxxxxxxxxxxx",
                        "tags": [
                            "tag1",
                            "tag2",
                            "tag3"
                        ],
                        "referringURL": ""
                    }
                }
            },
            "persistent": true
        }




Thanks
Joao Correia
--

*João Correia*

San Diego, CA
mobile: +1 (858) 284-6010
web: https://joaocorreia.io

Re: Javascript Tracker Page! properties

Posted by Serge Huber <sh...@jahia.com>.
Actually I think the REST API is the most important way to enrich a profile
because the web tracker is just a library on top of that.

In the future, the GraphQL API will make it even easier to use the API in
Javascript, since it won't require custom integrations anymore and you will
be able to use any GraphQL API client implementation available.

In the meantime, as I mentioned, there are already some improvements to the
web tracker committed, and fixing the fillPageData method shouldn't be too
difficult either, I'm just not sure I'll have the bandwidth to do it soon
as I'm focusing on the ElasticSearch 7 and JDK 11 support right now. If you
need this change however maybe some of my colleagues could take to you or
your team to help?

Regards,
  Serge....
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 Thu, Dec 5, 2019 at 9:00 PM João Correia <jo...@gmail.com> wrote:

> Got it!.
>
> My Javascript is not to the needed level to contribute, otherwise, I would.
>
> The web tracker is very limiting for now, I think this is one of the most
> important ways to enrich a profile, think any event that we might want to
> pass properties along, the current JS implementation doesn't allow it.
>
> I'm looking forward to following developments on the tracker!
>
> Thanks
> Joao Correia
>
> --
>
> *João Correia*
>
> San Diego, CA
> mobile: +1 (858) 284-6010
> web: https://joaocorreia.io
>
>
>
>
>
>
>
>
>
>
>
>
>
> On Thu, Dec 5, 2019 at 11:46 AM Serge Huber <sh...@jahia.com> wrote:
>
>> Hello João,
>>
>> It seems this is a limitation of the web tracker implementation. If you
>> look at this code here in the fillPageData it only copies some of the data:
>>
>>
>> https://github.com/apache/unomi/blob/a068e0242f50bc7f46a62e0020cf5ce3728c1396/extensions/web-tracker/javascript/src/analytics.js-integration-apache-unomi.js
>>
>> Unomi.prototype.fillPageData = function(unomiPage, props) {
>> unomiPage.attributes = [];
>> unomiPage.consentTypes = [];
>> unomiPage.interests = props.interests || {};
>> unomiPage.pageInfo = extend({}, unomiPage.pageInfo, props.pageInfo);
>> unomiPage.pageInfo.pageName = unomiPage.pageInfo.pageName || props.title;
>> unomiPage.pageInfo.pageID = unomiPage.pageInfo.pageID || props.path;
>> unomiPage.pageInfo.pagePath = unomiPage.pageInfo.pagePath || props.path;
>> unomiPage.pageInfo.destinationURL = unomiPage.pageInfo.destinationURL ||
>> props.url;
>> unomiPage.pageInfo.referringURL = unomiPage.pageInfo.referringURL ||
>> props.referrer;
>> this.processReferrer();
>> };
>>
>> I agree this is not ideal and should be made more generic. Feel free to
>> submit a PR if you want.
>>
>> Regards,
>>   Serge...
>> 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 Thu, Dec 5, 2019 at 7:07 PM João Correia <jo...@gmail.com>
>> wrote:
>>
>>> Hi Unomiers,
>>>
>>> Im looking to enrich a profile with some properties like CompanyDomain,
>>> Employees and others. Im trying to do this with the JS tracker by sending a
>>> pageview with properties but they aren't showing up on Unomi.
>>>
>>> I'm sending this:
>>>
>>> path = "/cb";
>>> properties = {
>>>       path: path,
>>>       attributes : ["test1"],
>>>       pageInfo: {
>>>         destinationURL: location.href,
>>>         tags : [ "tag1", "tag2", "tag3"],
>>>         categories : ["category1", "category2", "category3"],
>>>       },
>>>       interests : {
>>>         "interest1" : 1
>>>         ,"interest2" : 2
>>>         ,"interest3" : 3
>>>       },
>>>       attributes: [ "testattribute" ],
>>>       properties : {
>>>          "CompanyDomain": "Igloo Analytics"
>>>         ,"CompanyEmployees" : "1-10"
>>>       }
>>> };
>>>
>>> //console.log(properties);
>>> window.unomiTracker.page(properties);
>>>
>>> In the profile I see the event below.
>>> Why aren't the properties I sent showing up? Any ideas?
>>>
>>>        {
>>>             "itemId": "c600f6c5-ed0d-438f-bd29-5a2ac744446b",
>>>             "itemType": "event",
>>>             "scope": "aaa",
>>>             "version": 1,
>>>             "eventType": "view",
>>>             "sessionId": "44ca434d-35ce-5c14-a9bc-35cac9fe943c",
>>>             "profileId": "30ba35a2-c7cb-42d9-a58c-5569ab2d34ec",
>>>             "timeStamp": "2019-12-05T18:02:44Z",
>>>             "properties": {},
>>>             "source": {
>>>                 "itemId": "aaa",
>>>                 "itemType": "site",
>>>                 "scope": "aaa",
>>>                 "version": null,
>>>                 "properties": {}
>>>             },
>>>             "target": {
>>>                 "itemId": "/cb",
>>>                 "itemType": "page",
>>>                 "scope": "aaa",
>>>                 "version": null,
>>>                 "properties": {
>>>                     "attributes": [],
>>>                     "consentTypes": [],
>>>                     "interests": {
>>>                         "interest1": 1,
>>>                         "interest3": 3,
>>>                         "interest2": 2
>>>                     },
>>>                     "pageInfo": {
>>>                         "destinationURL": "https://www.xxxxx.com/",
>>>                         "categories": [
>>>                             "category1",
>>>                             "category2",
>>>                             "category3"
>>>                         ],
>>>                         "pageID": "/cb",
>>>                         "pagePath": "/cb",
>>>                         "pageName": "xxx: xxxxxxxxxxxx",
>>>                         "tags": [
>>>                             "tag1",
>>>                             "tag2",
>>>                             "tag3"
>>>                         ],
>>>                         "referringURL": ""
>>>                     }
>>>                 }
>>>             },
>>>             "persistent": true
>>>         }
>>>
>>>
>>>
>>>
>>> Thanks
>>> Joao Correia
>>> --
>>>
>>> *João Correia*
>>>
>>> San Diego, CA
>>> mobile: +1 (858) 284-6010
>>> web: https://joaocorreia.io
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>

Re: Javascript Tracker Page! properties

Posted by João Correia <jo...@gmail.com>.
Got it!.

My Javascript is not to the needed level to contribute, otherwise, I would.

The web tracker is very limiting for now, I think this is one of the most
important ways to enrich a profile, think any event that we might want to
pass properties along, the current JS implementation doesn't allow it.

I'm looking forward to following developments on the tracker!

Thanks
Joao Correia

--

*João Correia*

San Diego, CA
mobile: +1 (858) 284-6010
web: https://joaocorreia.io













On Thu, Dec 5, 2019 at 11:46 AM Serge Huber <sh...@jahia.com> wrote:

> Hello João,
>
> It seems this is a limitation of the web tracker implementation. If you
> look at this code here in the fillPageData it only copies some of the data:
>
>
> https://github.com/apache/unomi/blob/a068e0242f50bc7f46a62e0020cf5ce3728c1396/extensions/web-tracker/javascript/src/analytics.js-integration-apache-unomi.js
>
> Unomi.prototype.fillPageData = function(unomiPage, props) {
> unomiPage.attributes = [];
> unomiPage.consentTypes = [];
> unomiPage.interests = props.interests || {};
> unomiPage.pageInfo = extend({}, unomiPage.pageInfo, props.pageInfo);
> unomiPage.pageInfo.pageName = unomiPage.pageInfo.pageName || props.title;
> unomiPage.pageInfo.pageID = unomiPage.pageInfo.pageID || props.path;
> unomiPage.pageInfo.pagePath = unomiPage.pageInfo.pagePath || props.path;
> unomiPage.pageInfo.destinationURL = unomiPage.pageInfo.destinationURL ||
> props.url;
> unomiPage.pageInfo.referringURL = unomiPage.pageInfo.referringURL || props
> .referrer;
> this.processReferrer();
> };
>
> I agree this is not ideal and should be made more generic. Feel free to
> submit a PR if you want.
>
> Regards,
>   Serge...
> 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 Thu, Dec 5, 2019 at 7:07 PM João Correia <jo...@gmail.com>
> wrote:
>
>> Hi Unomiers,
>>
>> Im looking to enrich a profile with some properties like CompanyDomain,
>> Employees and others. Im trying to do this with the JS tracker by sending a
>> pageview with properties but they aren't showing up on Unomi.
>>
>> I'm sending this:
>>
>> path = "/cb";
>> properties = {
>>       path: path,
>>       attributes : ["test1"],
>>       pageInfo: {
>>         destinationURL: location.href,
>>         tags : [ "tag1", "tag2", "tag3"],
>>         categories : ["category1", "category2", "category3"],
>>       },
>>       interests : {
>>         "interest1" : 1
>>         ,"interest2" : 2
>>         ,"interest3" : 3
>>       },
>>       attributes: [ "testattribute" ],
>>       properties : {
>>          "CompanyDomain": "Igloo Analytics"
>>         ,"CompanyEmployees" : "1-10"
>>       }
>> };
>>
>> //console.log(properties);
>> window.unomiTracker.page(properties);
>>
>> In the profile I see the event below.
>> Why aren't the properties I sent showing up? Any ideas?
>>
>>        {
>>             "itemId": "c600f6c5-ed0d-438f-bd29-5a2ac744446b",
>>             "itemType": "event",
>>             "scope": "aaa",
>>             "version": 1,
>>             "eventType": "view",
>>             "sessionId": "44ca434d-35ce-5c14-a9bc-35cac9fe943c",
>>             "profileId": "30ba35a2-c7cb-42d9-a58c-5569ab2d34ec",
>>             "timeStamp": "2019-12-05T18:02:44Z",
>>             "properties": {},
>>             "source": {
>>                 "itemId": "aaa",
>>                 "itemType": "site",
>>                 "scope": "aaa",
>>                 "version": null,
>>                 "properties": {}
>>             },
>>             "target": {
>>                 "itemId": "/cb",
>>                 "itemType": "page",
>>                 "scope": "aaa",
>>                 "version": null,
>>                 "properties": {
>>                     "attributes": [],
>>                     "consentTypes": [],
>>                     "interests": {
>>                         "interest1": 1,
>>                         "interest3": 3,
>>                         "interest2": 2
>>                     },
>>                     "pageInfo": {
>>                         "destinationURL": "https://www.xxxxx.com/",
>>                         "categories": [
>>                             "category1",
>>                             "category2",
>>                             "category3"
>>                         ],
>>                         "pageID": "/cb",
>>                         "pagePath": "/cb",
>>                         "pageName": "xxx: xxxxxxxxxxxx",
>>                         "tags": [
>>                             "tag1",
>>                             "tag2",
>>                             "tag3"
>>                         ],
>>                         "referringURL": ""
>>                     }
>>                 }
>>             },
>>             "persistent": true
>>         }
>>
>>
>>
>>
>> Thanks
>> Joao Correia
>> --
>>
>> *João Correia*
>>
>> San Diego, CA
>> mobile: +1 (858) 284-6010
>> web: https://joaocorreia.io
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>

Re: Javascript Tracker Page! properties

Posted by Serge Huber <sh...@jahia.com>.
Hello João,

It seems this is a limitation of the web tracker implementation. If you
look at this code here in the fillPageData it only copies some of the data:

https://github.com/apache/unomi/blob/a068e0242f50bc7f46a62e0020cf5ce3728c1396/extensions/web-tracker/javascript/src/analytics.js-integration-apache-unomi.js

Unomi.prototype.fillPageData = function(unomiPage, props) {
unomiPage.attributes = [];
unomiPage.consentTypes = [];
unomiPage.interests = props.interests || {};
unomiPage.pageInfo = extend({}, unomiPage.pageInfo, props.pageInfo);
unomiPage.pageInfo.pageName = unomiPage.pageInfo.pageName || props.title;
unomiPage.pageInfo.pageID = unomiPage.pageInfo.pageID || props.path;
unomiPage.pageInfo.pagePath = unomiPage.pageInfo.pagePath || props.path;
unomiPage.pageInfo.destinationURL = unomiPage.pageInfo.destinationURL ||
props.url;
unomiPage.pageInfo.referringURL = unomiPage.pageInfo.referringURL || props.
referrer;
this.processReferrer();
};

I agree this is not ideal and should be made more generic. Feel free to
submit a PR if you want.

Regards,
  Serge...
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 Thu, Dec 5, 2019 at 7:07 PM João Correia <jo...@gmail.com> wrote:

> Hi Unomiers,
>
> Im looking to enrich a profile with some properties like CompanyDomain,
> Employees and others. Im trying to do this with the JS tracker by sending a
> pageview with properties but they aren't showing up on Unomi.
>
> I'm sending this:
>
> path = "/cb";
> properties = {
>       path: path,
>       attributes : ["test1"],
>       pageInfo: {
>         destinationURL: location.href,
>         tags : [ "tag1", "tag2", "tag3"],
>         categories : ["category1", "category2", "category3"],
>       },
>       interests : {
>         "interest1" : 1
>         ,"interest2" : 2
>         ,"interest3" : 3
>       },
>       attributes: [ "testattribute" ],
>       properties : {
>          "CompanyDomain": "Igloo Analytics"
>         ,"CompanyEmployees" : "1-10"
>       }
> };
>
> //console.log(properties);
> window.unomiTracker.page(properties);
>
> In the profile I see the event below.
> Why aren't the properties I sent showing up? Any ideas?
>
>        {
>             "itemId": "c600f6c5-ed0d-438f-bd29-5a2ac744446b",
>             "itemType": "event",
>             "scope": "aaa",
>             "version": 1,
>             "eventType": "view",
>             "sessionId": "44ca434d-35ce-5c14-a9bc-35cac9fe943c",
>             "profileId": "30ba35a2-c7cb-42d9-a58c-5569ab2d34ec",
>             "timeStamp": "2019-12-05T18:02:44Z",
>             "properties": {},
>             "source": {
>                 "itemId": "aaa",
>                 "itemType": "site",
>                 "scope": "aaa",
>                 "version": null,
>                 "properties": {}
>             },
>             "target": {
>                 "itemId": "/cb",
>                 "itemType": "page",
>                 "scope": "aaa",
>                 "version": null,
>                 "properties": {
>                     "attributes": [],
>                     "consentTypes": [],
>                     "interests": {
>                         "interest1": 1,
>                         "interest3": 3,
>                         "interest2": 2
>                     },
>                     "pageInfo": {
>                         "destinationURL": "https://www.xxxxx.com/",
>                         "categories": [
>                             "category1",
>                             "category2",
>                             "category3"
>                         ],
>                         "pageID": "/cb",
>                         "pagePath": "/cb",
>                         "pageName": "xxx: xxxxxxxxxxxx",
>                         "tags": [
>                             "tag1",
>                             "tag2",
>                             "tag3"
>                         ],
>                         "referringURL": ""
>                     }
>                 }
>             },
>             "persistent": true
>         }
>
>
>
>
> Thanks
> Joao Correia
> --
>
> *João Correia*
>
> San Diego, CA
> mobile: +1 (858) 284-6010
> web: https://joaocorreia.io
>
>
>
>
>
>
>
>
>
>
>
>
>