Open DevCEDTeam opened 1 year ago
To build and develop for Mautic Form events and email open pixel events through UTM query strings linked by a URL link trigger to Google Tag Manager and a data stream of a Google Analytics Dashboard using Google Cloud Functions, you can follow these step-by-step instructions:
Step 1: Set up a new Google Cloud project
Step 2: Enable required APIs
Step 3: Set up authentication
Step 4: Install and set up the Google Cloud SDK
gcloud auth activate-service-account --key-file=[PATH_TO_JSON_KEY_FILE]
Step 5: Create a new Cloud Function
package.json
with the following content:
{
"name": "cloudfunction",
"version": "1.0.0",
"description": "",
"main": "index.js",
"author": "",
"license": "ISC",
"dependencies": {
"axios": "^0.21.0"
}
}
index.js
and paste the provided code into it.Step 6: Deploy the Cloud Function
gcloud functions deploy mauticProxy --runtime nodejs14 --trigger-http --allow-unauthenticated
This will deploy the function with the name "mauticProxy" and make it accessible via an HTTP trigger.
Step 7: Configure Google Tag Manager
https://REGION-PROJECT_ID.cloudfunctions.net/mauticProxy?action=trackEvent&email={{Email}}&eventName={{EventName}}&eventData={{EventData}}
Step 8: Configure Mautic Event and Pixel
Step 9: Verify events in Google Analytics
That's it! You have now set up the infrastructure to track Mautic Form events and email open pixel events through UTM query strings linked by a URL link trigger to Google Tag Manager. The events
//
Email Tracking Events
Step-by-step guide on how to enable the Cloud Functions API, set up the local development environment, write the entire
index.js
file, deploy the Cloud Function to Google Cloud, set up Mautic Form event tracking, set up email open pixel tracking, set up a Google Analytics Dashboard, and test the tracking with sample codes.Step 1: Enable the Cloud Functions API
Step 2: Set up the local development environment
Step 3: Write the entire
index.js
file in the project directory Create a new file namedindex.js
in your project directory and add the following code:Note: Replace the placeholders
ACTID
,EVENTKEY
,APIURL
, andAPIKEY
with your actual values.Step 4: Deploy the Cloud Function to Google Cloud
YOUR_PROJECT_ID
with your actual project ID:Step 5: Set up Mautic Form event tracking
Step 6: Set up email open pixel tracking
Note: Replace
<your-cloud-function-url>
with the URL of your Cloud Function.Step 7: Set up Google Analytics Dashboard
Step 8: Test the tracking with sample codes You can test the tracking using the following sample codes and UTM query strings:
Sample code for Mautic form event:
Sample code for email open pixel:
Note: Replace
<your-cloud-function-url>
with the URL of your Cloud Function.That's it! You have now set up Mautic Form event tracking, email open pixel tracking, and a Google Analytics Dashboard using Google Cloud Functions. You can further customize and expand the tracking functionality as needed.