You cannot export behaviour (blueprint code) to gltf. glTF does not have representation for behaviour yet. If you export a scene or a selection, the exporter will try to get meshes and material used in that selection and export that.
If you speak about calling glTF export function you can do those either in blueprint or C++.