Closed colbyfayock closed 1 year ago
It seems to me that the NodeJS SDK url generation does not support tracking. For Gatsby these urls are created in the resolver when the site is built (aka. in a node environment).
Will it be added for feature parity with the Cloudinary URL-Gen SDK?
did a little digging and it seems like it might be available?
have you tried passing the options directly into the url
method? though the object.assign would make me think it would get overridden.
if that doesnt work ill ask the sdk team about seeing if we can get it added
Setting urlAnalytics
to true
added ?_s=AMAzlWK0
to the end of the URL.
const url = cloudinary.url(publicId, {
cloud_name: cloudName,
secure: options.secure,
transformation: transformation,
flags: flags,
urlAnalytics: true,
});
But I was not able to change the code added:
const url = cloudinary.url(publicId, {
cloud_name: cloudName,
secure: options.secure,
transformation: transformation,
flags: flags,
urlAnalytics: true,
sdkCode: 'X',
});
Looking at the code, I think you are right in that even if the sdkCode
for instance gets passed along it will be overridden. The code creating the sdkVersions
object used last in that assign you pointed to always returns an object with sdkCode
, sdkSemver
and techVersion
set.
:tada: This issue has been resolved in version 4.4.0 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
To give the ability to track Gatsby usage in addition to or separate from the standard JS usage, we'd like to add a custom Analytics ID
The Analytics token is appended at the end of Cloudinary URLs as a query parameter by the SDKs, giving us the ability to have insights as to what SDKs or tools are making Cloudinary requests.
The relevant code depends on the SDK being used, but the Cloudinary URL Gen SDK would be added similar to this work from Next Cloudinary:
https://github.com/colbyfayock/next-cloudinary/blob/ab7ba447af6eff264d9baf984ca513b5910a316e/next-cloudinary/src/lib/cloudinary.ts#L101
To implement, set the real versions including:
sdkCode
:X
(this is the Gatsby specific code)sdkVersion
: the current version of this Gatsby plugin (ideally dynamically added)techVersion
: the current Gatsby version being used (ideally dynamically added)