Skip to content

Disable (or set) tracking #273

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jeancroy opened this issue Jul 14, 2016 · 4 comments
Closed

Disable (or set) tracking #273

jeancroy opened this issue Jul 14, 2016 · 4 comments
Labels
status: help wanted requesting help from the community type: bug bug in the library

Comments

@jeancroy
Copy link

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
@thinkingserious
Copy link
Contributor

@jeancroy,

Thanks for the detailed report!

There is now an open pull request (see above) to fix this issue. Please track there.

Thanks!

@thinkingserious thinkingserious added type: bug bug in the library status: help wanted requesting help from the community labels Jul 14, 2016
@jeancroy
Copy link
Author

Hi @thinkingserious thanks for the quick response.

About that issue, I see a reference to error The click_tracking enable parameter is required.
I'd love very much to see those error when sending mail.

Is there a way to catch those from output of

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

@thinkingserious
Copy link
Contributor

Please keep an eye on this repo, I'll be adding a TROUBLESHOOTING.md file that explains how to use a Try/Catch block to grab the error message from the server. Thanks!

@thinkingserious
Copy link
Contributor

Fixed: #293

Will be updated to Nuget as version 8.0.2.

Here are the instructions on how to grab the errors: https://github.com/sendgrid/sendgrid-csharp/blob/master/TROUBLESHOOTING.md#error-messages

dubrovkinmaxim pushed a commit to dubrovkinmaxim/sendgrid-csharp that referenced this issue Sep 20, 2016
gabrielkrell pushed a commit to gabrielkrell/sendgrid-csharp that referenced this issue Aug 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: help wanted requesting help from the community type: bug bug in the library
Projects
None yet
Development

No branches or pull requests

2 participants