Skip to content

Disable (or set) tracking #273

@jeancroy

Description

@jeancroy

Issue Summary

I'm trying to improve my deliverability, and one thing I have seen in report of tool like mail-tester.com is that I use tracking with my email by default and some point are taken off because of that.

I have a base setup that work. However when trying to add tracking option configuration Sendgrid answer with 400 bad request. Removing the tracking configuration, everything work fine.

I've tried to add/remove different bit and pieces, each time having a bad request error. In term of communicating what need to be fixed, sendgrid is one of the least verbose api we use and it's a bit frustrating to work with.

Here's my latest attempt

public static void DisableTracking(Mail mail)
{

    mail.TrackingSettings = new TrackingSettings
    {
        ClickTracking = new ClickTracking {Enable = false, EnableText = false},
        Ganalytics = new Ganalytics { Enable = false, UtmCampaign = "", UtmContent = "", UtmMedium = "", UtmSource = "", UtmTerm = "" },
        OpenTracking = new OpenTracking {Enable = false, SubstitutionTag = ""},
        SubscriptionTracking = new SubscriptionTracking {Enable = false, Html = "",SubstitutionTag = "",Text = ""},
    };

}

And it would be used like so

    var mail = new Mail(from: from, subject: subject, to: to, content: plainContent);
    mail.AddContent(htmlContent);

    DisableTracking(mail);

    dynamic response = sg.client.mail.send.post(requestBody: mail.Get());

Technical details:

  • sendgrid-csharp Version: 7.0.4
  • .NET Version: 4.5.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions