OpenTracking

public struct OpenTracking : Encodable

The OpenTracking class is used to toggle the open tracking setting for an email.

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

    Declaration

    Swift

    public let enable: Bool
  • An optional tag to specify where to place the open tracking pixel.

    Declaration

    Swift

    public let substitutionTag: String?
  • Initializes the setting with a location to put the open tracking pixel at.

    If the open tracking setting is enabled by default on your SendGrid account and you want to disable it for this specific email, you should use the .off case.

    Declaration

    Swift

    public init(location: Location)

    Parameters

    location

    The location to put the open tracking pixel at in the email. If you want to turn the setting off, use the .off case.

  • The OpenTracking.Location enum represents where the open tracking pixel should be placed in the email.

    If the open tracking setting is enabled by default on your SendGrid account and you want to disable it for this specific email, you should use the .off case.

    • off: Disables open tracking for the email.
    • bottom: Places the open tracking pixel at the bottom of the email body.
    • at: Places the open tracking pixel at a specified substitution tag. For instance, if you wanted to place the open tracking pixel at the top of your email, you can specify this case with a tag, such as .at(tag: "%open_tracking%"), and then in the body of your email you can place the text %open_tracking% at the top. The tag will then be replaced with the open tracking pixel.
    See more

    Declaration

    Swift

    enum Location