<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Contact Endpoint API integration and Google Analytics in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Contact-Endpoint-API-integration-and-Google-Analytics/m-p/739463#M60180</link>
    <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We used to use the method of&amp;nbsp;&amp;nbsp;&lt;A href="https://legacydocs.hubspot.com/docs/methods/forms/submit_form" target="_blank" rel="noopener"&gt;Submit data to a form&lt;/A&gt; Endpoint to send the registartion data to Hubspot. However, we started to use &lt;A href="https://developers.hubspot.com/docs/api/crm/contacts" target="_blank" rel="noopener"&gt;Contact data endpoint&lt;/A&gt;&amp;nbsp;since we need to send registartion data 2 times due to nature of our form.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Our developers says that there will be no form submission with this approach, there will be only contact creation. So I am wondering how can I see form submission in Google tag manager? Do you have suggestions?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Normally, we used to track them like below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;gtmEventCategory: "sign-up.form",&lt;/DIV&gt;&lt;DIV&gt;gtmEventAction: "form.submit",&lt;/DIV&gt;&lt;DIV&gt;gtmEventLabel: "verifyMailForm"&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sebnem&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 10 Jan 2023 14:53:41 GMT</pubDate>
    <dc:creator>06401</dc:creator>
    <dc:date>2023-01-10T14:53:41Z</dc:date>
    <item>
      <title>Contact Endpoint API integration and Google Analytics</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Contact-Endpoint-API-integration-and-Google-Analytics/m-p/739463#M60180</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We used to use the method of&amp;nbsp;&amp;nbsp;&lt;A href="https://legacydocs.hubspot.com/docs/methods/forms/submit_form" target="_blank" rel="noopener"&gt;Submit data to a form&lt;/A&gt; Endpoint to send the registartion data to Hubspot. However, we started to use &lt;A href="https://developers.hubspot.com/docs/api/crm/contacts" target="_blank" rel="noopener"&gt;Contact data endpoint&lt;/A&gt;&amp;nbsp;since we need to send registartion data 2 times due to nature of our form.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Our developers says that there will be no form submission with this approach, there will be only contact creation. So I am wondering how can I see form submission in Google tag manager? Do you have suggestions?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Normally, we used to track them like below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;gtmEventCategory: "sign-up.form",&lt;/DIV&gt;&lt;DIV&gt;gtmEventAction: "form.submit",&lt;/DIV&gt;&lt;DIV&gt;gtmEventLabel: "verifyMailForm"&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sebnem&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 14:53:41 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Contact-Endpoint-API-integration-and-Google-Analytics/m-p/739463#M60180</guid>
      <dc:creator>06401</dc:creator>
      <dc:date>2023-01-10T14:53:41Z</dc:date>
    </item>
    <item>
      <title>Re: Contact Endpoint API integration and Google Analytics</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Contact-Endpoint-API-integration-and-Google-Analytics/m-p/740229#M60220</link>
      <description>&lt;P&gt;Hey,&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/432639"&gt;@06401&lt;/a&gt;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":waving_hand:"&gt;👋&lt;/span&gt; Thanks for reaching out. Let's see if we can get the conversation going —&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/257487"&gt;@LMeert&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/123138"&gt;@Ben-M&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/119931"&gt;@Leonard0&lt;/a&gt;&amp;nbsp;do you have any insight you can share with&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/432639"&gt;@06401&lt;/a&gt;?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much! — Jaycee&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jan 2023 17:35:30 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Contact-Endpoint-API-integration-and-Google-Analytics/m-p/740229#M60220</guid>
      <dc:creator>Jaycee_Lewis</dc:creator>
      <dc:date>2023-01-11T17:35:30Z</dc:date>
    </item>
    <item>
      <title>Re: Contact Endpoint API integration and Google Analytics</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Contact-Endpoint-API-integration-and-Google-Analytics/m-p/741792#M60312</link>
      <description>&lt;P&gt;Hi Sebnem,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;It is not possible to directly push data to a Google Data Studio data layer from an external script that is not executed on the webpage. The Google Data Studio data layer is a JavaScript object that is only accessible within the context of the webpage where it is loaded. However, there is a workaround that you can use to send data to Data Studio from an external script.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use a server-side script to collect data from your external script and then send it to Data Studio using the Data Studio API.&amp;nbsp;&lt;SPAN&gt;Here's an example of a server-side script in Node.js that collects data from an external script and sends it to a Data Studio report using the Data Studio API:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;const {google} = require('googleapis');
const dataStudio = google.datastudio('v1');

const reportId = 'REPORT_ID';
const datasetId = 'DATASET_ID';

// Collect data from form submission
app.post('/form-submission', (req, res) =&amp;gt; {
  const data = {
    category: req.body.category,
    action: req.body.action,
    label: req.body.label,
    date: new Date().toISOString()
  };

  // Authenticate with the Google API
  const auth = new google.auth.JWT(
    'your-service-account-email',
    'path/to/privatekey.pem',
    'your-private-key',
    ['https://www.googleapis.com/auth/datastudio']
  );

  // Append data to the Data Studio dataset
  dataStudio.data.append({
    auth,
    requestBody: {
      data: [data],
      datasetId,
      reportId,
      appendMode: 'APPEND'
    }
  });
});
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In this example, the script is using the &lt;/SPAN&gt;&lt;CODE&gt;req.body&lt;/CODE&gt;&lt;SPAN&gt; object from an express.js application to collect data from the form submission. The script is collecting the &lt;/SPAN&gt;&lt;CODE&gt;category&lt;/CODE&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;CODE&gt;action&lt;/CODE&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;CODE&gt;label&lt;/CODE&gt;&lt;SPAN&gt; and &lt;/SPAN&gt;&lt;CODE&gt;date&lt;/CODE&gt;&lt;SPAN&gt; fields and the values are assigned to the corresponding keys in the data object. The &lt;/SPAN&gt;&lt;CODE&gt;date&lt;/CODE&gt;&lt;SPAN&gt; field is being set to the current date and time.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You will need to replace 'your-service-account-email', 'path/to/privatekey.pem', and 'your-private-key' with your own values. You also need to replace 'REPORT_ID' and 'DATASET_ID' with the IDs of the report and dataset you want to send data to.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is important to note that in order to use this script, you will need to create a Service Account with appropriate permissions and also enable Data Studio API on your project. You may need to follow the instructions on the following link to set it up: &lt;A href="https://developers.google.com/datastudio/api/guides/authentication" target="_new"&gt;https://developers.google.com/datastudio/api/guides/authentication&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, the example script is based on Node.js and Google client library, but you can use any other language or library as long as it allows you to make authenticated requests to the Data Studio API.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2023 09:09:28 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Contact-Endpoint-API-integration-and-Google-Analytics/m-p/741792#M60312</guid>
      <dc:creator>Leonard0</dc:creator>
      <dc:date>2023-01-16T09:09:28Z</dc:date>
    </item>
    <item>
      <title>Re: Contact Endpoint API integration and Google Analytics</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Contact-Endpoint-API-integration-and-Google-Analytics/m-p/741839#M60319</link>
      <description>&lt;P&gt;Hi Leonard,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you. However, we do not use Data Studio and&amp;nbsp; i know that Data Studio gets the data from google analytics so i can assume that we can also see data in Google Analytics 4 with this method,right?&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Sebnem&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2023 10:39:07 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Contact-Endpoint-API-integration-and-Google-Analytics/m-p/741839#M60319</guid>
      <dc:creator>06401</dc:creator>
      <dc:date>2023-01-16T10:39:07Z</dc:date>
    </item>
    <item>
      <title>Re: Contact Endpoint API integration and Google Analytics</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Contact-Endpoint-API-integration-and-Google-Analytics/m-p/742160#M60345</link>
      <description>&lt;P&gt;Hi Sebnem,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm sorry, for some reason I mix-up GTM and Data Studio sometimes 🤦🏻‍&lt;/P&gt;
&lt;P&gt;With an event you can send data to GTM data layer like below (client side). However if you are posting server side, you need a server-side GTM container.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't have any experience with a server-side setup unfortunately. You need to check out documentation about that, here for example:&amp;nbsp;&lt;A href="https://developers.google.com/tag-platform/tag-manager/server-side" target="_blank" rel="noopener"&gt;https://developers.google.com/tag-platform/tag-manager/server-side&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;    window.dataLayer = window.dataLayer || [];
    window.dataLayer.push({
      'containerId': 'GTM-XXXXXXX',
      event: 'contactCreated',
      eventCategory: data.category,
      eventAction: data.action,
      eventLabel: data.label
    });&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2023 23:10:43 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Contact-Endpoint-API-integration-and-Google-Analytics/m-p/742160#M60345</guid>
      <dc:creator>Leonard0</dc:creator>
      <dc:date>2023-01-16T23:10:43Z</dc:date>
    </item>
  </channel>
</rss>

