ClickTracking

public struct ClickTracking : Encodable

The ClickTracking class is used to adjust the click tracking setting.

  • A bool indicating if the setting should be toggled on or off.

    Declaration

    Swift

    public let enable: Bool
  • A boolean indicating if click tracking should also be applied to links inside a plain text email.

    Declaration

    Swift

    public let enableText: Bool?
  • Initializes the setting encoding a specified section of the email.

    In general, you should use the .htmlBody case, as only the HTML body of an email can have clickable links.

    If, for some reason, you want the URLs in the plain text body of an email to be tracked as well, you should use the .plainTextAndHTMLBodies case instead. Be aware, though, that having both sections tracked will result in long URLs showing up in the plain text body.

    If click tracking is normally enabled on your SendGrid account and you want to disable it for this particular email, use the .off case.

    Declaration

    Swift

    public init(section: ClickTracking.Section)

    Parameters

    section

    The section to track links in, or .off to disable the setting.

  • This enum represents the sections of an email that click tracking should be applied to. In general, you should use the .htmlBody case, as only the HTML body of an email can have clickable links.

    If, for some reason, you want the URLs in the plain text body of an email to be tracked as well, you should use the .plainTextAndHTMLBodies case instead. Be aware, though, that having both sections tracked will result in long URLs showing up in the plain text body.

    If click tracking is normally enabled on your SendGrid account and you want to disable it for this particular email, use the .off case.

    • off: If used, the setting will be disabled for this email.
    • htmlBody: If used, links in the HTML body of the email will be encoded and tracked.
    • plainTextAndHTMLBodies: If used, links in the HTML body and URLs in the plain text body will be encoded and tracked.
    See more

    Declaration

    Swift

    enum Section