Analytics in AMP Emails
Interactive AMP emails are more similar to landing pages or websites than to regular emails, so event tracking here is a bit more complex than just “opens” or “clicks,” as we’re used to with standard HTML emails. So how can you track custom events within an email? This is where Pixcraft’s integration with Google Analytics 4 comes in.
Adding the Integration
- Go to Settings/Google Analytics in the left-hand menu and click Add new integration.
- Then, go to your Google Analytics 4 account and open the data stream settings: Admin > Data collection and modification > Data streams
- Select the data stream. Then click on Measurement Protocol API secrets. In the window that opens, click Create.
- Go back to Pixcraft
In the Name your GA integration field, enter a name that will be displayed in the settings.
In the Measurement ID field, enter the value specified in the data stream settings.
And in the Measurement secret key field, enter the key you generated in the previous step.
Then save the integration.
Configuring Data Storage
In GA4, you need to explicitly define which custom event fields you want to store. Similar to how it worked in UA, we’ve provided fields like action, campaign, and source. Let’s configure GA4 to store these values. To do this, go to Admin > Data display > Custom definitions
Select Create custom dimension. In the window that opens:
- Dimension name: Event action
- Scope: event
- Description: action triggered in the email
- Event parameter: action
Repeat these steps for the campaign and source parameters if you plan to use them.
Tracking Events in the Email
Go to Pixcraft Settings > Google Analytics and click on the integration you previously added:
In the Event name field, enter the name of the event. All other fields are optional.
As you fill in the data, a tracking pixel code will be generated for embedding in your email. Note that code is generated for both the HTML version and the AMP version of the email.
You can copy the generated code with one click and paste it into your email template.
Please note that to collect accurate data, each subscriber must receive a unique image. To ensure this, you need to insert a unique value into the cid field. This can be the subscriber’s ID in your system, a hash of their ID, a hash of their email, or any other unique identifier.