# marketingEngagementsDelete - admin-graphql - MUTATION Version: 2024-10 ## Description Marks channel-level engagement data such that it no longer appears in reports. Activity-level data cannot be deleted directly, instead the MarketingActivity itself should be deleted to hide it from reports. ### Access Scopes `write_marketing_events` access scope. ## Arguments * [channelHandle](/docs/api/admin-graphql/2024-10/scalars/String): String - The handle of the channel for which engagement data should be deleted. * [deleteEngagementsForAllChannels](/docs/api/admin-graphql/2024-10/scalars/Boolean): Boolean - When true, engagements for all channels that belong to the api client will be deleted. ## Returns * [result](/docs/api/admin-graphql/2024-10/scalars/String): String Informational message about the engagement data that has been marked for deletion. * [userErrors](/docs/api/admin-graphql/2024-10/objects/MarketingActivityUserError): MarketingActivityUserError! The list of errors that occurred from executing the mutation. ## Examples ### Mark all channel level engagement data associated to the api client for deletion Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation M($channelHandle: String, $deleteEngagementsForAllChannels: Boolean) { marketingEngagementsDelete(channelHandle: $channelHandle, deleteEngagementsForAllChannels: $deleteEngagementsForAllChannels) { result userErrors { field message } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `mutation M($channelHandle: String, $deleteEngagementsForAllChannels: Boolean) {\n marketingEngagementsDelete(channelHandle: $channelHandle, deleteEngagementsForAllChannels: $deleteEngagementsForAllChannels) {\n result\n userErrors {\n field\n message\n }\n }\n }`,\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation M($channelHandle: String, $deleteEngagementsForAllChannels: Boolean) {\n marketingEngagementsDelete(channelHandle: $channelHandle, deleteEngagementsForAllChannels: $deleteEngagementsForAllChannels) {\n result\n userErrors {\n field\n message\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation M($channelHandle: String, $deleteEngagementsForAllChannels: Boolean) {\n marketingEngagementsDelete(channelHandle: $channelHandle, deleteEngagementsForAllChannels: $deleteEngagementsForAllChannels) {\n result\n userErrors {\n field\n message\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "mutation M($channelHandle: String, $deleteEngagementsForAllChannels: Boolean) {\n marketingEngagementsDelete(channelHandle: $channelHandle, deleteEngagementsForAllChannels: $deleteEngagementsForAllChannels) {\n result\n userErrors {\n field\n message\n }\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "marketingEngagementsDelete": { "result": "Engagement data marked for deletion for 5 channel(s)", "userErrors": [] } } } ### Mark engagement data associated to a specific channel for deletion Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation M($channelHandle: String, $deleteEngagementsForAllChannels: Boolean) { marketingEngagementsDelete(channelHandle: $channelHandle, deleteEngagementsForAllChannels: $deleteEngagementsForAllChannels) { result userErrors { field message } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `mutation M($channelHandle: String, $deleteEngagementsForAllChannels: Boolean) {\n marketingEngagementsDelete(channelHandle: $channelHandle, deleteEngagementsForAllChannels: $deleteEngagementsForAllChannels) {\n result\n userErrors {\n field\n message\n }\n }\n }`,\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation M($channelHandle: String, $deleteEngagementsForAllChannels: Boolean) {\n marketingEngagementsDelete(channelHandle: $channelHandle, deleteEngagementsForAllChannels: $deleteEngagementsForAllChannels) {\n result\n userErrors {\n field\n message\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation M($channelHandle: String, $deleteEngagementsForAllChannels: Boolean) {\n marketingEngagementsDelete(channelHandle: $channelHandle, deleteEngagementsForAllChannels: $deleteEngagementsForAllChannels) {\n result\n userErrors {\n field\n message\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "mutation M($channelHandle: String, $deleteEngagementsForAllChannels: Boolean) {\n marketingEngagementsDelete(channelHandle: $channelHandle, deleteEngagementsForAllChannels: $deleteEngagementsForAllChannels) {\n result\n userErrors {\n field\n message\n }\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "marketingEngagementsDelete": { "result": "Engagement data associated to channel handle 'my-channel-handle' marked for deletion", "userErrors": [] } } }