2

I have created a Goal, deployed and published it. After that, I have applied the goal on the Sitecore Media Item. I am working with Sitecore 9 update 2.

For More reference: https://urbansitecore.blog/2017/10/25/how-to-track-pdf-download/

On selection of Media item, its downloaded pdf file but Goal is not reflected into the Experience Profile. I have written code for Abandon the session as well. My questions are:

  1. Does the Experience profile take time to display the goal? I have checked the user Activity Tab > Goals in the Experience profile and Conversions > Goals in Experience Analytics. The goal is not there.

  2. If it takes time to display then How much time it will take or where I can Update/Set this time?

  3. In which XDB table it is going to be saved so that I can check it with Shard0/1 Database?

  4. User is not an Anonymous, it's a known user and I am able to see its data except Goal on the Experience Profile tab.

  5. As per @Chris Auer Suggestion in the answer, able to see Goal information into the [xdb_collection].[Interactions] table.

Thanks.

3
  • In your [Processing Pools] data, can you tell me how many records are in the [InteractionLiveProcessingPool] table? SELECT COUNT(*) FROM [xdb_processing_pools].[InteractionLiveProcessingPool]
    – Chris Auer
    May 26, 2019 at 12:22
  • Hello, @ChrisAuer, There is no record in this table. May 26, 2019 at 15:52
  • Ok perfect. That means there isn’t a backlog of items to be written to xDB.
    – Chris Auer
    May 26, 2019 at 15:57

2 Answers 2

3

When does is it written to xDB

Like the other answers said, it is written when the session closes. The time it takes to be written is in the web.config, in the session config. In the xml below, it is the timeout. This number is in minutes.

<sessionState mode="InProc" cookieless="false" timeout="20" sessionIDManagerType="Sitecore.SessionManagement.ConditionalSessionIdManager">

So you do not have to wait, you can create a page or controller that will close the session for you. Just run this code and it will cause the xDB data to be written right away.

Session.Abandon();

Where is it written

The goal is written to the [xdb_collection].[Interactions] table in your shard databases.

If you query the table you can see the interactions, you can see the goals.

SELECT *
  FROM [Xdb.Collection.Shard0].[xdb_collection].[Interactions]

enter image description here

Looking at the JSON in that field, the JSON will look like this.

[
   {
      "@odata.type":"#Sitecore.XConnect.Goal",
      "CustomValues":[

      ],
      "DefinitionId":"82c4c49c-b6b2-4b02-8e2f-fbcba9f92fe4",
      "EngagementValue":60,
      "Id":"335c92ce-5e36-4b13-9472-4940ad66e75f",
      "Timestamp":"2019-05-07T23:53:34.4268677Z"
   }
]

Is your test user anonymous?

By default Sitecore does not track anonymous users. And if your test user is anonymous, you are not going to see them in Experience Profile to see the goal. See here for turning it on.

Toot my own horn

I wrote a little tool that shows you in JSON what goals you have triggered in your current session and past sessions. You can find a 9.0.1 release. That should work with your 9.0.2 instance. When you trigger a goal in your session, you can just use an API to see what you triggered. It looks like this.

{
   "GoalsList":[
      {
         "EngagementValue":5,
         "Title":"2nd Visit",
         "Date":"2019-04-23T01:13:43.8962374Z",
         "IsCurrentVisit":false,
         "Data":null
      },
   ],
   "PastGoals":[
      {
         "EngagementValue":5,
         "Title":"3rd Visit",
         "Date":"2019-04-23T01:45:01.34653Z",
         "IsCurrentVisit":false,
         "Data":null
      },
      {
         "EngagementValue":5,
         "Title":"2nd Visit",
         "Date":"2019-05-14T03:43:12.6848242Z",
         "IsCurrentVisit":false,
         "Data":null
      },
      {
         "EngagementValue":5,
         "Title":"2nd Visit",
         "Date":"2019-05-21T21:41:56.6825674Z",
         "IsCurrentVisit":false,
         "Data":null
      }
   ]
}

The code to get the current is this. You can see the code here.

public IEnumerable<PageEvent> GetCurrentGoals()
{
    var conversions = (from page in Tracker.Current.Interaction.GetPages()
        from pageEventData in page.PageEvents
         where pageEventData.IsGoal
         select pageEventData).ToList();

     foreach (var cachedGoal in conversions)
     {
         var goal = GetGoalDefinition(cachedGoal.ItemId);

         yield return new PageEvent
         {
             Title = goal?.Name ?? "(Unknown)",
             Date = cachedGoal.DateTime,
             EngagementValue = goal?.EngagementValuePoints ?? 0,
             IsCurrentVisit = false,
             Data = cachedGoal.Data
         };
    }
}
2
  • Hello @Chris Auer, Thanks for the Update. (1) I have written code for Session Abandon. (2) User is not Anonymous its known user, I am able to see its information except goal in experience profile. (3) Yes, I am able to see Goal information into Interactions table. Thanks. (4) But Goal is not displayed on the Experience Profile Tab. (5) The day before yesterday the Goal which triggered today are now showing on the Experience profile tab. Strange. May 26, 2019 at 5:49
  • Updated question. May 26, 2019 at 5:56
0

The Session needs to be ended then only the goals will appear. This is because xDB data is not committed until after the user's session ends.

Also Recycle the site from App pool.

for more info. https://doc.sitecore.com/sitecore_experience_platform/setting_up__maintaining/xdb/session_state/session_state

3
  • I mentioned that I have Abandon session as well. May 25, 2019 at 11:14
  • Recycle the site from App pool.
    – Rajasekar
    May 25, 2019 at 11:17
  • Hi, @Rajasekar, Recycled the site from App pool, still no success. Above give link showing page not found message. May 26, 2019 at 5:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.