Send With Confidence
Partner with the email service trusted by developers and marketers for time-savings, scalability, and delivery expertise.
Time to read: 6 minutes
https://www.example.com/weekly-specials
. You can add query parameters of your choosing, such as campaign_id
, and give the URL a distinct value for your email campaign. The resulting URL to use in your email might look like this:
https://www.example.com/weekly-specials?campaign_id=winter-campaign-01
winter_campaign_email_clicked
. Next, set the conditions that indicate this event has occurred. For our custom event example, we have 2 conditions:
event_name
will be page_view
.page_location
(the referring link that brought the user to your site) will contain campaign_id=winter-campaign-01
(our unique query parameter distinguishing our email campaign).winter_campaign_email_clicked
.
@sendgrid/mail
package:
~/project$ yarn init
~/project$ yarn add @sendgrid/mail
index.js
and put it in your project folder. Because this is an example mail sending application that you run at the command line, you’ll need to include a few environment variables when running the application:
API_KEY
: This is your Twilio SendGrid account API key.CUSTOM_URL
: This is the custom URL for your email campaign that directs users to your site and includes your unique query parameter.RECIPIENT_EMAIL
: This is the recipient’s email address. (When testing, use an email address you can access so that you can verify you received the email and can click the campaign link inside.)~/project$ API_KEY=INSERT-YOUR-API-KEY-HERE
CUSTOM_URL=https://www.example.com/weekly-specials?campaign_id=winter-campaign-01
RECIPIENT_EMAIL=INSERT-YOUR-EMAIL-ADDRESS-HERE
node index.js
RECIPIENT_EMAIL
. When you click on the URL within the email, GA will count this as a conversion. Next, we’ll look at how to view these conversions in GA.
winter_campaign_email_clicked
event and added it as a Conversion event. After clicking on the campaign link in the email you received, you’ll soon see a new conversion event in the Realtime report:
Partner with the email service trusted by developers and marketers for time-savings, scalability, and delivery expertise.