{"id":7874,"date":"2022-10-19T11:54:08","date_gmt":"2022-10-19T11:54:08","guid":{"rendered":"https:\/\/docs.campaignsuite.nl\/docs\/gravity-forms\/measurement\/facebook\/"},"modified":"2022-10-19T12:39:58","modified_gmt":"2022-10-19T12:39:58","slug":"facebook","status":"publish","type":"docs","link":"https:\/\/docs.campaignsuite.nl\/en\/docs\/gravity-forms\/measurement\/facebook\/","title":{"rendered":"Facebook"},"content":{"rendered":"\n<p><img decoding=\"async\" src=\"https:\/\/docs.campaignsuite.nl\/wp-content\/uploads\/2022\/10\/facebook_logo.png\" style=\"width: 150px;\" align=\"right\">The provider Facebook gives you the ability to only make Server Side API calls to the Facebook Conversion API. This can be done at any of the six available event moments. Click <a rel=\"noreferrer noopener\" href=\"https:\/\/www.facebook.com\/business\/help\/2041148702652965?id=8188590332317965\" target=\"_blank\">here<\/a> to get more information about the Facebook Conversion API. <\/p>\n\n\n\n<p>To use the Facebook provider in Measurements you must have entered a Pixel ID and an Access token in the CampaignSuite settings. Without these two values \u200b\u200bit is not possible to use this provider. More information about setting up a Pixel can be found at <a rel=\"noreferrer noopener\" href=\"https:\/\/www.facebook.com\/business\/help\/952192354843755?id=818859032317965\" target=\"_blank\">this page<\/a>.<\/p>\n\n\n\n<p>The Facebook Conversion API works on the basis of events. CampaignSuite will create a JSON based on the mapping made in the Feed action, which will be sent via a POST request to Facebook&#8217;s API. See the example below of the mapping in CampaignSuite and the JSON sent to Facebook.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Example of mapping:<\/h4>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"868\" height=\"505\" src=\"https:\/\/docs.campaignsuite.nl\/wp-content\/uploads\/2022\/10\/measurement_fb_mapping-1.png\" alt=\"\" class=\"wp-image-7905\" srcset=\"https:\/\/docs.campaignsuite.nl\/wp-content\/uploads\/2022\/10\/measurement_fb_mapping-1.png 868w, https:\/\/docs.campaignsuite.nl\/wp-content\/uploads\/2022\/10\/measurement_fb_mapping-1-300x175.png 300w, https:\/\/docs.campaignsuite.nl\/wp-content\/uploads\/2022\/10\/measurement_fb_mapping-1-768x447.png 768w\" sizes=\"auto, (max-width: 868px) 100vw, 868px\" \/><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">JSON being generated:<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n   \"data\": &#91;\n      {\n         \"event_name\": \"Purchase\",\n         \"event_time\" \"1666081911\",\n         \"event_id\": \"1_346\",\n         \"event_source_url\": \"https:\/\/www.examplewebsite.nl\/doneer\",\n         \"action_source\": \"site\",\n         \"user_data\": {\n            \"client_ip_address\": \"1.1.1.1\",\n            \"client_user_agent\": \"Mozilla\/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit\/537.36 (KHTML, like Gecko)\",\n            \"em\": \"309a0a5c3e211326ae75ca18196d301a9bdbd1a882a4d2569511033da23f0abd\",\n            \"fn\": \"254aa248acb47dd654ca3ea53f48c2c26d641d23d7e2e93a1ec56258df7674c4\",\n            \"ln\": \"eeacc9d4cf711ce63f7d247062f52ca2fe4be1a1a8aef231fe23e75e7bdca60c\",\n            \"ph\": \"191d48a770670b9ae8f59dbb16c64c583f92d1922a2a440b26e36bf6e3970bf0\"\n         },\n         \"custom_data\": {\n            \"value\": 100.2,\n            \"currency\": \"EUR\",\n            \"form_id\": \"1\",\n            \"entry_id\": \"346\"\n         }\n      }\n   ]\n}<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li><span style=\"font-weight: bold; text-decoration: underline;\">event_id<\/span><br>The <strong>event_id<\/strong> parameter is automatically filled with a combination of the form ID and the entry ID (1_346). <\/li><li><strong><span style=\"text-decoration: underline;\">action_source<\/span><\/strong><br>The parameter <strong>action_source<\/strong> will be automatically filled with the value <strong>website<\/strong> provided it is not mapped with its own value. <\/li><li><strong><span style=\"text-decoration: underline;\">event_time<\/span><\/strong><br>The parameter <strong>event_time<\/strong> is filled by default with the date and time of submission in the form.<\/li><li><strong><span style=\"text-decoration: underline;\">custom_data.currency<\/span><\/strong><br>The parameter &lt; strong>custom_data.currency is filled by default with the event type <strong>After a successful payment.<\/strong><\/li><\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">Custom parameters<\/h4>\n\n\n\n<p>In addition to the predefined parameters, it is also possible to send parameters yourself. Click <a rel=\"noreferrer noopener\" href=\"https:\/\/developers.facebook.com\/docs\/marketing-api\/conversions-api\/parameters\/\" target=\"_blank\">here<\/a> for a list of the available parameters for Facebook.<br>For example, to add a city field to <strong>user_data<\/strong> you must enter as key value: <strong>data.user_data.ct.<\/strong> This will then automatically in the JSON.<br>In the example above, the phone number field custom has been added.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The provider Facebook gives you the ability to only make Server Side API calls to the Facebook Conversion API. This can be done at any of the six available event moments. Click here to get more information about the Facebook Conversion API. To use the Facebook provider in Measurements you must have entered a Pixel [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":7768,"menu_order":4,"comment_status":"open","ping_status":"closed","template":"","doc_tag":[],"class_list":["post-7874","docs","type-docs","status-publish","hentry","no-post-thumbnail"],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.campaignsuite.nl\/en\/wp-json\/wp\/v2\/docs\/7874","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/docs.campaignsuite.nl\/en\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/docs.campaignsuite.nl\/en\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/docs.campaignsuite.nl\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.campaignsuite.nl\/en\/wp-json\/wp\/v2\/comments?post=7874"}],"version-history":[{"count":8,"href":"https:\/\/docs.campaignsuite.nl\/en\/wp-json\/wp\/v2\/docs\/7874\/revisions"}],"predecessor-version":[{"id":7930,"href":"https:\/\/docs.campaignsuite.nl\/en\/wp-json\/wp\/v2\/docs\/7874\/revisions\/7930"}],"up":[{"embeddable":true,"href":"https:\/\/docs.campaignsuite.nl\/en\/wp-json\/wp\/v2\/docs\/7768"}],"wp:attachment":[{"href":"https:\/\/docs.campaignsuite.nl\/en\/wp-json\/wp\/v2\/media?parent=7874"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/docs.campaignsuite.nl\/en\/wp-json\/wp\/v2\/doc_tag?post=7874"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}