{"action":"created","issue":{"url":"https://api.github.com/repos/MarkEdmondson1234/googleAnalyticsR/issues/166","repository_url":"https://api.github.com/repos/MarkEdmondson1234/googleAnalyticsR","labels_url":"https://api.github.com/repos/MarkEdmondson1234/googleAnalyticsR/issues/166/labels{/name}","comments_url":"https://api.github.com/repos/MarkEdmondson1234/googleAnalyticsR/issues/166/comments","events_url":"https://api.github.com/repos/MarkEdmondson1234/googleAnalyticsR/issues/166/events","html_url":"https://github.com/MarkEdmondson1234/googleAnalyticsR/issues/166","id":311035351,"number":166,"title":"segment_element object won't allow me to filter events","user":{"login":"OscarLane","id":12962258,"avatar_url":"https://avatars0.githubusercontent.com/u/12962258?v=4","gravatar_id":"","url":"https://api.github.com/users/OscarLane","html_url":"https://github.com/OscarLane","followers_url":"https://api.github.com/users/OscarLane/followers","following_url":"https://api.github.com/users/OscarLane/following{/other_user}","gists_url":"https://api.github.com/users/OscarLane/gists{/gist_id}","starred_url":"https://api.github.com/users/OscarLane/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OscarLane/subscriptions","organizations_url":"https://api.github.com/users/OscarLane/orgs","repos_url":"https://api.github.com/users/OscarLane/repos","events_url":"https://api.github.com/users/OscarLane/events{/privacy}","received_events_url":"https://api.github.com/users/OscarLane/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-04-03T23:40:40Z","updated_at":"2018-04-11T04:08:45Z","closed_at":"2018-04-11T04:08:45Z","author_association":"NONE","body":"First let me say, this is a terrific package and thank you so much for your hard work creating it. However, I'm having a little trouble achieving a certain task having followed what seems to me to be the most appropriate documentation.\r\n\r\nI am attempting to extract information from Google Analytics on website activity for users who have triggered a custom event.\r\n\r\nI have been using the documentation at http://code.markedmondson.me/googleAnalyticsR/v4.html (see the section called \"Segments v4\"). Following this, I have set up a segment_element object to filter the entries by the eventCategory name, which is \"My Event Category Name\" in the example below. In this example I have used an exact match, but have also tried regex to no avail.\r\n\r\n```\r\nse <- segment_element(\"ga:eventCategory\",\r\n                  operator = \"EXACT\",\r\n                  type = \"DIMENSION\",\r\n                  expressions = \"My Event Category Name\")\r\n\r\nsv_simple <- segment_vector_simple(list(list(se)))\r\n\r\nseg_defined <- segment_define(list(sv_simple))\r\n\r\nsegment4 <- segment_ga4(\"my_segment\", user_segment = seg_defined)\r\n\r\nsegment_example <- google_analytics(my_id,\r\n                                date_range = c(\"2018-01-01\", \"2018-03-15\"),\r\n                                dimensions = c(\"ga:eventCategory\", \"segment\"),\r\n                                segments = segment4,\r\n                                metrics = c(\"pageViews\"),\r\n                                anti_sample = TRUE)\r\n```\r\n\r\nI have a list of event categories that show up in the table of results, which are not filtered to just the \"My Event Category Name\"  eventCategory object, rather they appear as:\r\n\r\n```\r\nsegment     | eventCategory          | pageViews\r\n------------------------------------------------\r\nmy_segment  | My Event Category Name | 2165817\r\nmy_segment  | Download               | 44872\r\nmy_segment  | External Links         | 1771636\r\netc...      | ...                    | ...\r\n```\r\n\r\nMy understanding is that the segment_element object I have set up should filter the above table by the eventCategory column to those lines that only include My Event Category Name. So, in this case, that would be:\r\n\r\n```\r\nsegment     | eventCategory          | pageViews\r\n------------------------------------------------\r\nmy_segment  | My Event Category Name | 2165817\r\n```\r\n\r\nHowever, this is not the case. Does anyone have any advice as to how I should approach this to get the desired result?"},"comment":{"url":"https://api.github.com/repos/MarkEdmondson1234/googleAnalyticsR/issues/comments/380320973","html_url":"https://github.com/MarkEdmondson1234/googleAnalyticsR/issues/166#issuecomment-380320973","issue_url":"https://api.github.com/repos/MarkEdmondson1234/googleAnalyticsR/issues/166","id":380320973,"user":{"login":"OscarLane","id":12962258,"avatar_url":"https://avatars0.githubusercontent.com/u/12962258?v=4","gravatar_id":"","url":"https://api.github.com/users/OscarLane","html_url":"https://github.com/OscarLane","followers_url":"https://api.github.com/users/OscarLane/followers","following_url":"https://api.github.com/users/OscarLane/following{/other_user}","gists_url":"https://api.github.com/users/OscarLane/gists{/gist_id}","starred_url":"https://api.github.com/users/OscarLane/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OscarLane/subscriptions","organizations_url":"https://api.github.com/users/OscarLane/orgs","repos_url":"https://api.github.com/users/OscarLane/repos","events_url":"https://api.github.com/users/OscarLane/events{/privacy}","received_events_url":"https://api.github.com/users/OscarLane/received_events","type":"User","site_admin":false},"created_at":"2018-04-11T04:08:45Z","updated_at":"2018-04-11T04:08:45Z","author_association":"NONE","body":"Hi Mark, yes that seems to have fixed things up for me! I think I was imagining the underlying table structure was something different to what it actually is, and that events were a special case (it appears that they are not).\r\n\r\nMany thanks for your helpful suggestion!"}}
{"actor":{"display_login":"OscarLane"}}