User Analytics - Activity Metrics in Application Insights - what is the logic of the plugin

%3CLINGO-SUB%20id%3D%22lingo-sub-876808%22%20slang%3D%22en-US%22%3EUser%20Analytics%20-%20Activity%20Metrics%20in%20Application%20Insights%20-%20what%20is%20the%20logic%20of%20the%20plugin%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-876808%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20everybody%2C%3CBR%20%2F%3E%3CBR%20%2F%3EI%20have%20several%20sites%20that%20contain%20games%20on%20them.%20I%20track%20all%20sites%20by%20one%20Application%20Insights%20resource.%20Now%20I%20want%20to%20calculate%20retention%20rate%20of%20each%20game%20on%20every%20site%20(or%20on%20all%20sites%20overall).%26nbsp%3B%3CBR%20%2F%3ETo%20figure%20this%20out%20I%20used%20this%20plugin%3A%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fkusto%2Fquery%2Fnew-activity-metrics-plugin%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fkusto%2Fquery%2Fnew-activity-metrics-plugin%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMy%20question%20here%20is%20-%20does%20measure%20'dcount_retained_users'%20count%20for%20site%20and%20game%26nbsp%3Bsimultaneously%20or%20only%20for%20site%3F%3CBR%20%2F%3EI%20want%20to%20know%20how%20many%20people%20come%20back%20and%20play%20the%20same%20game%20on%20the%20same%20site%20as%20they%20did%20at%20their%20first%20week.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EHere%20is%20my%20script%20below.%20Please%20help%20me%20to%20understand%20the%20plugin%20and%20how%20i%20can%20solve%20my%20problem%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CDIV%3E%3CDIV%3E%3CSPAN%3Elet%20start0%20%3D%20ago(%3C%2FSPAN%3E%3CSPAN%3E90%3C%2FSPAN%3E%3CSPAN%3Ed)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Elet%20end%20%3D%20ago(%3C%2FSPAN%3E%3CSPAN%3E1%3C%2FSPAN%3E%3CSPAN%3Ed)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Elet%20w0%20%3D%20customEvents%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Ewhere%3C%2FSPAN%3E%3CSPAN%3E%20timestamp%20%26gt%3B%20start0%20%3C%2FSPAN%3E%3CSPAN%3Eand%3C%2FSPAN%3E%3CSPAN%3E%20name%20%3D%3D%20%3C%2FSPAN%3E%3CSPAN%3E%22start%22%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eextend%3C%2FSPAN%3E%3CSPAN%3E%20site%20%3D%20tostring(customDimensions.%5B%3C%2FSPAN%3E%3CSPAN%3E'site'%3C%2FSPAN%3E%3CSPAN%3E%5D)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eextend%3C%2FSPAN%3E%3CSPAN%3E%20game%20%3D%20tostring(customDimensions.%5B%3C%2FSPAN%3E%3CSPAN%3E'game'%3C%2FSPAN%3E%3CSPAN%3E%5D)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eevaluate%3C%2FSPAN%3E%3CSPAN%3E%20new_activity_metrics(user_Id%20%2C%20timestamp%2C%20start0%2C%20end%2C%20%3C%2FSPAN%3E%3CSPAN%3E7%3C%2FSPAN%3E%3CSPAN%3Ed%2C%20start0%2C%20game%2C%20site)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Elet%20start1%20%3D%20start0%2B%3C%2FSPAN%3E%3CSPAN%3E7%3C%2FSPAN%3E%3CSPAN%3Ed%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Elet%20w1%20%3D%20customEvents%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Ewhere%3C%2FSPAN%3E%3CSPAN%3E%20timestamp%20%26gt%3B%20start1%20%3C%2FSPAN%3E%3CSPAN%3Eand%3C%2FSPAN%3E%3CSPAN%3E%20name%20%3D%3D%20%3C%2FSPAN%3E%3CSPAN%3E%22start%22%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eextend%3C%2FSPAN%3E%3CSPAN%3E%20site%20%3D%20tostring(customDimensions.%5B%3C%2FSPAN%3E%3CSPAN%3E'site'%3C%2FSPAN%3E%3CSPAN%3E%5D)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eextend%3C%2FSPAN%3E%3CSPAN%3E%20game%20%3D%20tostring(customDimensions.%5B%3C%2FSPAN%3E%3CSPAN%3E'game'%3C%2FSPAN%3E%3CSPAN%3E%5D)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eevaluate%3C%2FSPAN%3E%3CSPAN%3E%20new_activity_metrics(user_Id%20%2C%20timestamp%2C%20start1%2C%20end%2C%20%3C%2FSPAN%3E%3CSPAN%3E7%3C%2FSPAN%3E%3CSPAN%3Ed%2C%20start1%2C%20game%2C%20site)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Elet%20start2%20%3D%20start1%2B%3C%2FSPAN%3E%3CSPAN%3E7%3C%2FSPAN%3E%3CSPAN%3Ed%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Elet%20w2%20%3D%20customEvents%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Ewhere%3C%2FSPAN%3E%3CSPAN%3E%20timestamp%20%26gt%3B%20start2%20%3C%2FSPAN%3E%3CSPAN%3Eand%3C%2FSPAN%3E%3CSPAN%3E%20name%20%3D%3D%20%3C%2FSPAN%3E%3CSPAN%3E%22start%22%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eextend%3C%2FSPAN%3E%3CSPAN%3E%20site%20%3D%20tostring(customDimensions.%5B%3C%2FSPAN%3E%3CSPAN%3E'site'%3C%2FSPAN%3E%3CSPAN%3E%5D)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eextend%3C%2FSPAN%3E%3CSPAN%3E%20game%20%3D%20tostring(customDimensions.%5B%3C%2FSPAN%3E%3CSPAN%3E'game'%3C%2FSPAN%3E%3CSPAN%3E%5D)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eevaluate%3C%2FSPAN%3E%3CSPAN%3E%20new_activity_metrics(user_Id%20%2C%20timestamp%2C%20start2%2C%20end%2C%20%3C%2FSPAN%3E%3CSPAN%3E7%3C%2FSPAN%3E%3CSPAN%3Ed%2C%20start2%2C%20game%2C%20site)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Elet%20start3%20%3D%20start2%2B%3C%2FSPAN%3E%3CSPAN%3E7%3C%2FSPAN%3E%3CSPAN%3Ed%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Elet%20w3%20%3D%20customEvents%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Ewhere%3C%2FSPAN%3E%3CSPAN%3E%20timestamp%20%26gt%3B%20start3%20%3C%2FSPAN%3E%3CSPAN%3Eand%3C%2FSPAN%3E%3CSPAN%3E%20name%20%3D%3D%20%3C%2FSPAN%3E%3CSPAN%3E%22start%22%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eextend%3C%2FSPAN%3E%3CSPAN%3E%20site%20%3D%20tostring(customDimensions.%5B%3C%2FSPAN%3E%3CSPAN%3E'site'%3C%2FSPAN%3E%3CSPAN%3E%5D)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eextend%3C%2FSPAN%3E%3CSPAN%3E%20game%20%3D%20tostring(customDimensions.%5B%3C%2FSPAN%3E%3CSPAN%3E'game'%3C%2FSPAN%3E%3CSPAN%3E%5D)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eevaluate%3C%2FSPAN%3E%3CSPAN%3E%20new_activity_metrics(user_Id%20%2C%20timestamp%2C%20start3%2C%20end%2C%20%3C%2FSPAN%3E%3CSPAN%3E7%3C%2FSPAN%3E%3CSPAN%3Ed%2C%20start3%2C%20game%2C%20site)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Elet%20start4%20%3D%20start3%2B%3C%2FSPAN%3E%3CSPAN%3E7%3C%2FSPAN%3E%3CSPAN%3Ed%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Elet%20w4%20%3D%20customEvents%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Ewhere%3C%2FSPAN%3E%3CSPAN%3E%20timestamp%20%26gt%3B%20start4%20%3C%2FSPAN%3E%3CSPAN%3Eand%3C%2FSPAN%3E%3CSPAN%3E%20name%20%3D%3D%20%3C%2FSPAN%3E%3CSPAN%3E%22start%22%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eextend%3C%2FSPAN%3E%3CSPAN%3E%20site%20%3D%20tostring(customDimensions.%5B%3C%2FSPAN%3E%3CSPAN%3E'site'%3C%2FSPAN%3E%3CSPAN%3E%5D)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eextend%3C%2FSPAN%3E%3CSPAN%3E%20game%20%3D%20tostring(customDimensions.%5B%3C%2FSPAN%3E%3CSPAN%3E'game'%3C%2FSPAN%3E%3CSPAN%3E%5D)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eevaluate%3C%2FSPAN%3E%3CSPAN%3E%20new_activity_metrics(user_Id%20%2C%20timestamp%2C%20start4%2C%20end%2C%20%3C%2FSPAN%3E%3CSPAN%3E7%3C%2FSPAN%3E%3CSPAN%3Ed%2C%20start4%2C%20game%2C%20site)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Elet%20start5%20%3D%20start4%2B%3C%2FSPAN%3E%3CSPAN%3E7%3C%2FSPAN%3E%3CSPAN%3Ed%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Elet%20w5%20%3D%20customEvents%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Ewhere%3C%2FSPAN%3E%3CSPAN%3E%20timestamp%20%26gt%3B%20start5%20%3C%2FSPAN%3E%3CSPAN%3Eand%3C%2FSPAN%3E%3CSPAN%3E%20name%20%3D%3D%20%3C%2FSPAN%3E%3CSPAN%3E%22start%22%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eextend%3C%2FSPAN%3E%3CSPAN%3E%20site%20%3D%20tostring(customDimensions.%5B%3C%2FSPAN%3E%3CSPAN%3E'site'%3C%2FSPAN%3E%3CSPAN%3E%5D)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eextend%3C%2FSPAN%3E%3CSPAN%3E%20game%20%3D%20tostring(customDimensions.%5B%3C%2FSPAN%3E%3CSPAN%3E'game'%3C%2FSPAN%3E%3CSPAN%3E%5D)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eevaluate%3C%2FSPAN%3E%3CSPAN%3E%20new_activity_metrics(user_Id%20%2C%20timestamp%2C%20start5%2C%20end%2C%20%3C%2FSPAN%3E%3CSPAN%3E7%3C%2FSPAN%3E%3CSPAN%3Ed%2C%20start5%2C%20game%2C%20site)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Elet%20start6%20%3D%20start5%2B%3C%2FSPAN%3E%3CSPAN%3E7%3C%2FSPAN%3E%3CSPAN%3Ed%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Elet%20w6%20%3D%20customEvents%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Ewhere%3C%2FSPAN%3E%3CSPAN%3E%20timestamp%20%26gt%3B%20start6%20%3C%2FSPAN%3E%3CSPAN%3Eand%3C%2FSPAN%3E%3CSPAN%3E%20name%20%3D%3D%20%3C%2FSPAN%3E%3CSPAN%3E%22start%22%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eextend%3C%2FSPAN%3E%3CSPAN%3E%20site%20%3D%20tostring(customDimensions.%5B%3C%2FSPAN%3E%3CSPAN%3E'site'%3C%2FSPAN%3E%3CSPAN%3E%5D)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eextend%3C%2FSPAN%3E%3CSPAN%3E%20game%20%3D%20tostring(customDimensions.%5B%3C%2FSPAN%3E%3CSPAN%3E'game'%3C%2FSPAN%3E%3CSPAN%3E%5D)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eevaluate%3C%2FSPAN%3E%3CSPAN%3E%20new_activity_metrics(user_Id%20%2C%20timestamp%2C%20start6%2C%20end%2C%20%3C%2FSPAN%3E%3CSPAN%3E7%3C%2FSPAN%3E%3CSPAN%3Ed%2C%20start6%2C%20game%2C%20site)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Elet%20start7%20%3D%20start6%2B%3C%2FSPAN%3E%3CSPAN%3E7%3C%2FSPAN%3E%3CSPAN%3Ed%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Elet%20w7%20%3D%20customEvents%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Ewhere%3C%2FSPAN%3E%3CSPAN%3E%20timestamp%20%26gt%3B%20start7%20%3C%2FSPAN%3E%3CSPAN%3Eand%3C%2FSPAN%3E%3CSPAN%3E%20name%20%3D%3D%20%3C%2FSPAN%3E%3CSPAN%3E%22start%22%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eextend%3C%2FSPAN%3E%3CSPAN%3E%20site%20%3D%20tostring(customDimensions.%5B%3C%2FSPAN%3E%3CSPAN%3E'site'%3C%2FSPAN%3E%3CSPAN%3E%5D)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eextend%3C%2FSPAN%3E%3CSPAN%3E%20game%20%3D%20tostring(customDimensions.%5B%3C%2FSPAN%3E%3CSPAN%3E'game'%3C%2FSPAN%3E%3CSPAN%3E%5D)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eevaluate%3C%2FSPAN%3E%3CSPAN%3E%20new_activity_metrics(user_Id%20%2C%20timestamp%2C%20start7%2C%20end%2C%20%3C%2FSPAN%3E%3CSPAN%3E7%3C%2FSPAN%3E%3CSPAN%3Ed%2C%20start7%2C%20game%2C%20site)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Elet%20start8%20%3D%20start7%2B%3C%2FSPAN%3E%3CSPAN%3E7%3C%2FSPAN%3E%3CSPAN%3Ed%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Elet%20w8%20%3D%20customEvents%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Ewhere%3C%2FSPAN%3E%3CSPAN%3E%20timestamp%20%26gt%3B%20start8%20%3C%2FSPAN%3E%3CSPAN%3Eand%3C%2FSPAN%3E%3CSPAN%3E%20name%20%3D%3D%20%3C%2FSPAN%3E%3CSPAN%3E%22start%22%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eextend%3C%2FSPAN%3E%3CSPAN%3E%20site%20%3D%20tostring(customDimensions.%5B%3C%2FSPAN%3E%3CSPAN%3E'site'%3C%2FSPAN%3E%3CSPAN%3E%5D)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eextend%3C%2FSPAN%3E%3CSPAN%3E%20game%20%3D%20tostring(customDimensions.%5B%3C%2FSPAN%3E%3CSPAN%3E'game'%3C%2FSPAN%3E%3CSPAN%3E%5D)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eevaluate%3C%2FSPAN%3E%3CSPAN%3E%20new_activity_metrics(user_Id%20%2C%20timestamp%2C%20start8%2C%20end%2C%20%3C%2FSPAN%3E%3CSPAN%3E7%3C%2FSPAN%3E%3CSPAN%3Ed%2C%20start8%2C%20game%2C%20site)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Elet%20start9%20%3D%20start8%2B%3C%2FSPAN%3E%3CSPAN%3E7%3C%2FSPAN%3E%3CSPAN%3Ed%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Elet%20w9%20%3D%20customEvents%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Ewhere%3C%2FSPAN%3E%3CSPAN%3E%20timestamp%20%26gt%3B%20start9%20%3C%2FSPAN%3E%3CSPAN%3Eand%3C%2FSPAN%3E%3CSPAN%3E%20name%20%3D%3D%20%3C%2FSPAN%3E%3CSPAN%3E%22start%22%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eextend%3C%2FSPAN%3E%3CSPAN%3E%20site%20%3D%20tostring(customDimensions.%5B%3C%2FSPAN%3E%3CSPAN%3E'site'%3C%2FSPAN%3E%3CSPAN%3E%5D)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eextend%3C%2FSPAN%3E%3CSPAN%3E%20game%20%3D%20tostring(customDimensions.%5B%3C%2FSPAN%3E%3CSPAN%3E'game'%3C%2FSPAN%3E%3CSPAN%3E%5D)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eevaluate%3C%2FSPAN%3E%3CSPAN%3E%20new_activity_metrics(user_Id%20%2C%20timestamp%2C%20start9%2C%20end%2C%20%3C%2FSPAN%3E%3CSPAN%3E7%3C%2FSPAN%3E%3CSPAN%3Ed%2C%20start9%2C%20game%2C%20site)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Elet%20start10%20%3D%20start9%2B%3C%2FSPAN%3E%3CSPAN%3E7%3C%2FSPAN%3E%3CSPAN%3Ed%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Elet%20w10%20%3D%20customEvents%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Ewhere%3C%2FSPAN%3E%3CSPAN%3E%20timestamp%20%26gt%3B%20start10%20%3C%2FSPAN%3E%3CSPAN%3Eand%3C%2FSPAN%3E%3CSPAN%3E%20name%20%3D%3D%20%3C%2FSPAN%3E%3CSPAN%3E%22start%22%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eextend%3C%2FSPAN%3E%3CSPAN%3E%20site%20%3D%20tostring(customDimensions.%5B%3C%2FSPAN%3E%3CSPAN%3E'site'%3C%2FSPAN%3E%3CSPAN%3E%5D)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eextend%3C%2FSPAN%3E%3CSPAN%3E%20game%20%3D%20tostring(customDimensions.%5B%3C%2FSPAN%3E%3CSPAN%3E'game'%3C%2FSPAN%3E%3CSPAN%3E%5D)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eevaluate%3C%2FSPAN%3E%3CSPAN%3E%20new_activity_metrics(user_Id%20%2C%20timestamp%2C%20start10%2C%20end%2C%20%3C%2FSPAN%3E%3CSPAN%3E7%3C%2FSPAN%3E%3CSPAN%3Ed%2C%20start10%2C%20game%2C%20site)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Elet%20start11%20%3D%20start10%2B%3C%2FSPAN%3E%3CSPAN%3E7%3C%2FSPAN%3E%3CSPAN%3Ed%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Elet%20w11%20%3D%20customEvents%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Ewhere%3C%2FSPAN%3E%3CSPAN%3E%20timestamp%20%26gt%3B%20start11%20%3C%2FSPAN%3E%3CSPAN%3Eand%3C%2FSPAN%3E%3CSPAN%3E%20name%20%3D%3D%20%3C%2FSPAN%3E%3CSPAN%3E%22start%22%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eextend%3C%2FSPAN%3E%3CSPAN%3E%20site%20%3D%20tostring(customDimensions.%5B%3C%2FSPAN%3E%3CSPAN%3E'site'%3C%2FSPAN%3E%3CSPAN%3E%5D)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eextend%3C%2FSPAN%3E%3CSPAN%3E%20game%20%3D%20tostring(customDimensions.%5B%3C%2FSPAN%3E%3CSPAN%3E'game'%3C%2FSPAN%3E%3CSPAN%3E%5D)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eevaluate%3C%2FSPAN%3E%3CSPAN%3E%20new_activity_metrics(user_Id%20%2C%20timestamp%2C%20start11%2C%20end%2C%20%3C%2FSPAN%3E%3CSPAN%3E7%3C%2FSPAN%3E%3CSPAN%3Ed%2C%20start11%2C%20game%2C%20site)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Elet%20start12%20%3D%20start11%2B%3C%2FSPAN%3E%3CSPAN%3E7%3C%2FSPAN%3E%3CSPAN%3Ed%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Elet%20w12%20%3D%20customEvents%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Ewhere%3C%2FSPAN%3E%3CSPAN%3E%20timestamp%20%26gt%3B%20start12%20%3C%2FSPAN%3E%3CSPAN%3Eand%3C%2FSPAN%3E%3CSPAN%3E%20name%20%3D%3D%20%3C%2FSPAN%3E%3CSPAN%3E%22start%22%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eextend%3C%2FSPAN%3E%3CSPAN%3E%20site%20%3D%20tostring(customDimensions.%5B%3C%2FSPAN%3E%3CSPAN%3E'site'%3C%2FSPAN%3E%3CSPAN%3E%5D)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eextend%3C%2FSPAN%3E%3CSPAN%3E%20game%20%3D%20tostring(customDimensions.%5B%3C%2FSPAN%3E%3CSPAN%3E'game'%3C%2FSPAN%3E%3CSPAN%3E%5D)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eevaluate%3C%2FSPAN%3E%3CSPAN%3E%20new_activity_metrics(user_Id%20%2C%20timestamp%2C%20start12%2C%20end%2C%20%3C%2FSPAN%3E%3CSPAN%3E7%3C%2FSPAN%3E%3CSPAN%3Ed%2C%20start12%2C%20game%2C%20site)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Elet%20sourceTable%20%3D%20%3C%2FSPAN%3E%3CSPAN%3Eunion%3C%2FSPAN%3E%3CSPAN%3E%20w0%2Cw1%2Cw2%2Cw3%2Cw4%2Cw5%2Cw6%2Cw7%2Cw8%2Cw9%2Cw10%2Cw11%2Cw12%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EsourceTable%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eproject%3C%2FSPAN%3E%3CSPAN%3E%20from_timestamp%2Cto_timestamp%2Csite%2Cgame%2Cdcount_new_values%2Cdcount_retained_values%2Cdcount_churn_values%2Cretention_rate%2Cchurn_rate%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-876808%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EApplication%20Insights%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAzure%20Log%20Analytics%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Occasional Contributor

Hello everybody,

I have several sites that contain games on them. I track all sites by one Application Insights resource. Now I want to calculate retention rate of each game on every site (or on all sites overall). 
To figure this out I used this plugin:
https://docs.microsoft.com/en-us/azure/kusto/query/new-activity-metrics-plugin

 

My question here is - does measure 'dcount_retained_users' count for site and game simultaneously or only for site?
I want to know how many people come back and play the same game on the same site as they did at their first week.


Here is my script below. Please help me to understand the plugin and how i can solve my problem:

let start0 = ago(90d);
let end = ago(1d);
let w0 = customEvents
| where timestamp > start0 and name == "start"
| extend site = tostring(customDimensions.['site'])
| extend game = tostring(customDimensions.['game'])
| evaluate new_activity_metrics(user_Id , timestamp, start0, end, 7d, start0, game, site);
let start1 = start0+7d;
let w1 = customEvents
| where timestamp > start1 and name == "start"
| extend site = tostring(customDimensions.['site'])
| extend game = tostring(customDimensions.['game'])
| evaluate new_activity_metrics(user_Id , timestamp, start1, end, 7d, start1, game, site);
let start2 = start1+7d;
let w2 = customEvents
| where timestamp > start2 and name == "start"
| extend site = tostring(customDimensions.['site'])
| extend game = tostring(customDimensions.['game'])
| evaluate new_activity_metrics(user_Id , timestamp, start2, end, 7d, start2, game, site);
let start3 = start2+7d;
let w3 = customEvents
| where timestamp > start3 and name == "start"
| extend site = tostring(customDimensions.['site'])
| extend game = tostring(customDimensions.['game'])
| evaluate new_activity_metrics(user_Id , timestamp, start3, end, 7d, start3, game, site);
let start4 = start3+7d;
let w4 = customEvents
| where timestamp > start4 and name == "start"
| extend site = tostring(customDimensions.['site'])
| extend game = tostring(customDimensions.['game'])
| evaluate new_activity_metrics(user_Id , timestamp, start4, end, 7d, start4, game, site);
let start5 = start4+7d;
let w5 = customEvents
| where timestamp > start5 and name == "start"
| extend site = tostring(customDimensions.['site'])
| extend game = tostring(customDimensions.['game'])
| evaluate new_activity_metrics(user_Id , timestamp, start5, end, 7d, start5, game, site);
let start6 = start5+7d;
let w6 = customEvents
| where timestamp > start6 and name == "start"
| extend site = tostring(customDimensions.['site'])
| extend game = tostring(customDimensions.['game'])
| evaluate new_activity_metrics(user_Id , timestamp, start6, end, 7d, start6, game, site);
let start7 = start6+7d;
let w7 = customEvents
| where timestamp > start7 and name == "start"
| extend site = tostring(customDimensions.['site'])
| extend game = tostring(customDimensions.['game'])
| evaluate new_activity_metrics(user_Id , timestamp, start7, end, 7d, start7, game, site);
let start8 = start7+7d;
let w8 = customEvents
| where timestamp > start8 and name == "start"
| extend site = tostring(customDimensions.['site'])
| extend game = tostring(customDimensions.['game'])
| evaluate new_activity_metrics(user_Id , timestamp, start8, end, 7d, start8, game, site);
let start9 = start8+7d;
let w9 = customEvents
| where timestamp > start9 and name == "start"
| extend site = tostring(customDimensions.['site'])
| extend game = tostring(customDimensions.['game'])
| evaluate new_activity_metrics(user_Id , timestamp, start9, end, 7d, start9, game, site);
let start10 = start9+7d;
let w10 = customEvents
| where timestamp > start10 and name == "start"
| extend site = tostring(customDimensions.['site'])
| extend game = tostring(customDimensions.['game'])
| evaluate new_activity_metrics(user_Id , timestamp, start10, end, 7d, start10, game, site);
let start11 = start10+7d;
let w11 = customEvents
| where timestamp > start11 and name == "start"
| extend site = tostring(customDimensions.['site'])
| extend game = tostring(customDimensions.['game'])
| evaluate new_activity_metrics(user_Id , timestamp, start11, end, 7d, start11, game, site);
let start12 = start11+7d;
let w12 = customEvents
| where timestamp > start12 and name == "start"
| extend site = tostring(customDimensions.['site'])
| extend game = tostring(customDimensions.['game'])
| evaluate new_activity_metrics(user_Id , timestamp, start12, end, 7d, start12, game, site);
let sourceTable = union w0,w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11,w12;
sourceTable
| project from_timestamp,to_timestamp,site,game,dcount_new_values,dcount_retained_values,dcount_churn_values,retention_rate,churn_rate
0 Replies