Place the cranberries in a preserving pan or large saucepan with the onions, tomatoes, apples, garlic and vinegar. Bring to the boil and simmer for about 20 minutes or until the fruit is well broken down.
Add the ginger, salt and sugar and stir continuously until dissolved. Simmer uncovered for about 1½ hours, stirring from time to time to prevent sticking, until thick and syrupy
Pour into warmed jars and cover at once with waxed discs and a vinegar-proof cover. Cool and label. Store in a cool dry place for 2-4 weeks before use.